Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INCCHAR parameter in CPYF command

Status
Not open for further replies.

Ju5

Programmer
May 25, 2007
85
PH
I'm trying to filter data during a CPYF and was wondering if anyone knew how to use the INCCHAR parameter.

The data I'm copying has a field called date1 and storess the date in a yyyymmdd numeric format. I need only the from January to June. Will using the following in the INCCHAR filed work?
INCCHAR(DATE1 5 *LT 7)
 
Accordng to my notes, this only works if the field is character. You can use INCCHAR(*RCD 65 *LT '07') where 65 is the starting position of the month you want to compare in the record; replace it with whatever your value is. This works on character or unpacked numeric positions. There may be a way to get it to work with packed but I don't have it in my notes.

You may be better off using a SQL statement such as

insert into file2
select date1 from file1
where substring(date1, 5, 2) < 7

[rockband]
 
The program is in CL and I was hoping to keep code modification to a minimum.

How does INRECL work?
 
CPYF FROMFILE(...)
TOFILE(...)
INCREL((*IF DATE1 *GE 20080101) (*AND DATE1 *LE 20080731))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top