Posted: Tue Aug 05, 2003 2:14 am Post subject: Writing extra fields in the output
Hi,
I have an input file of length of 1000 bytes.
The output file has a length of 1010 bytes.
There is a date field in the input file which I would want to compare with a constant and if it is lesser than the constant I want to write 'A' in to the last ten bytes of output file and if it is greater I want to write 'B' in the last ten bytes.
Is it possible to do the above using SORT and if so please let me know how.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Aug 05, 2003 6:29 am Post subject:
Param,
The following JCl will give you the desired results. I am assuming that yout data field starts at 25 for a length of 10 bytes in the format CCYY-MM-DD.
Code:
//STEP100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//A DD DSN=YOUR OUTPUT FILE A,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//B DD DSN=YOUR OUTPUT FILE B,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=A,INCLUDE=(25,10,CH,LT,C'2003-08-05'), $ DATE CHECK
OUTREC=(01,1000, $ FIRST 1000 BYTES
25,10) $ DATE IN LAST 10 BYTES
OUTFIL FNAMES=B,INCLUDE=(25,10,CH,GT,C'2003-08-05'), $ DATE CHECK
OUTREC=(01,1000, $ FIRST 1000 BYTES
25,10) $ DATE IN LAST 10 BYTES
//*
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Aug 05, 2003 11:11 am Post subject:
Kolusu,
Shouldn't you have C'constant' instead of 25,10 since Param wanted to write 'A' or 'B' in the last 10 bytes, and of course, you need to add the SEQNUM and sort on it to get the records in the right order as Param recognized. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Aug 05, 2003 2:40 pm Post subject:
Frank,
I guess I intrepreted the question wrong. I assumed that param wanted the date field in the last 10 bytes. But you may be right that he wanted the "constant" in the last 10 bytes.
Param here is a revised DFSORT/ICETOOL JCl which will give you the desired results.If you have syncsort at your shop then change the pgm name to synctool.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum