Since, I need to seperate a Single file in to 10 files. The single file will be consisting of 10 Header and n number of details records and its respective trailer record.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Feb 08, 2006 8:42 am Post subject:
ha.rajamohamed,
Code:
//CTL1CNTL DD *
OUTREC FIELDS=(8,2, $ COPY 2 BYTES FROM POS 8
SEQNUM,8,ZD) $ SEQNUM OF 8 BYTES
OUTFIL FNAMES=BH, $ OUTPUT FILENAME BH
INCLUDE=(1,2,CH,EQ,C'BH'), $ WRITE OUT ONLY BH RECORDS
OUTREC=(C' OUTFIL FNAMES=BATC H', $ CHARACTER STRING WITHIN QUOTES
SEQNUM,3,ZD, $ SEQNUM OF 3 BYTES
C',STARTREC=', $ CHARACTER STRING WITHIN QUOTES
3,8, $ COPY 8 BYTES FROM POS 3
C',ENDREC=00000000', $ CHARACTER STRING WITHIN QUOTES
80:X, $ PAD SPACES UPTO 80 BYTES
SEQNUM,8,ZD) $ SEQNUM OF 8 BYTES
OUTFIL FNAMES=BT, $ OUTPUT FILENAME BT
INCLUDE=(1,2,CH,EQ,C'BT'), $ WRITE OUT ONLY BT RECORDS
OUTREC=(49X, $ 49 SPACES
3,8, $ COPY 8 BYTES FROM POS 3
80:X, $ PAD SPACES UPTO 80 BYTES
SEQNUM,8,ZD) $ SEQNUM OF 8 BYTES
//CTL2CNTL DD *
OPTION ZDPRINT $ PRINTABLE RESULTS OPTION
SORT FIELDS=(81,8,CH,A) $ SORT FOR 8 BYTES AT POS 81
SUM FIELDS=(50,8,ZD) $ SUM ON 8 BYTES AT POS 50
OUTFIL FNAMES=CTL3CNTL, $ OUTPUT FILENAME CTL3CNTL
ENDREC=8, $ WRITE ONLY 8 RECORDS
OUTREC=(1,80) $ COPY ONLY FIRST 80 BYTES
//CTL3CNTL DD DSN=&C1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
Quote:
Since, I need to seperate a Single file in to 10 files. The single file will be consisting of 10 Header and n number of details records and its respective trailer record.
Kolusu, very thanks for the explanation,
I need to seperate it in to 10 file, with out editing on the input file.
My header record is identified by HEX"00000000" (Low values of 4 char in the first col)
and Trailer record is identified by HEX"FFFFFFFF" (Highvalues values of 4 char in the first col)
For the above, I am not sure what all need to be changed.
Can you please let me know what I need to change in the above control card.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Feb 08, 2006 10:33 am Post subject:
ha.rajamohamed,
The following DFSORT/ICETOOL JCL will give you desired results. if your shop has syncsort then change the pgm name to synctool. I assumed your header and trlr values start in pos 1.
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=YOUR INPUT DSN,
// DISP=SHR
//HEAD DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//TRLR DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//CON DD DSN=&T1,DISP=OLD,VOL=REF=*.HEAD
// DD DSN=&T2,DISP=OLD,VOL=REF=*.TRLR
//OUT001 DD SYSOUT=*
//OUT002 DD SYSOUT=*
//OUT003 DD SYSOUT=*
//OUT004 DD SYSOUT=*
//OUT005 DD SYSOUT=*
//OUT006 DD SYSOUT=*
//OUT007 DD SYSOUT=*
//OUT008 DD SYSOUT=*
//OUT009 DD SYSOUT=*
//OUT010 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(CON) USING(CTL2)
COPY FROM(IN) USING(CTL3)
//CTL1CNTL DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,4,SEQNUM,8,ZD)
OUTFIL FNAMES=HEAD, $ OUTPUT FILENAME HEAD
INCLUDE=(1,4,CH,EQ,X'00'), $ WRITE OUT ONLY HEAD RECORDS
OUTREC=(C' OUTFIL FNAMES=OUT', $ CHARACTER STRING WITHIN QUOTES
SEQNUM,3,ZD, $ SEQNUM OF 3 BYTES
C',STARTREC=', $ CHARACTER STRING WITHIN QUOTES
5,8, $ COPY 8 BYTES FROM POS 5
C',ENDREC=00000000', $ CHARACTER STRING WITHIN QUOTES
80:X, $ PAD SPACES UPTO 80 BYTES
SEQNUM,8,ZD) $ SEQNUM OF 8 BYTES
OUTFIL FNAMES=TRLR, $ OUTPUT FILENAME TRLR
INCLUDE=(1,4,CH,EQ,X'FF'), $ WRITE OUT ONLY TRLR RECORDS
OUTREC=(47X, $ 47 SPACES
5,8, $ COPY 8 BYTES FROM POS 3
80:X, $ PAD SPACES UPTO 80 BYTES
SEQNUM,8,ZD) $ SEQNUM OF 8 BYTES
//CTL2CNTL DD *
OPTION ZDPRINT $ PRINTABLE RESULTS OPTION
SORT FIELDS=(81,8,CH,A) $ SORT FOR 8 BYTES AT POS 81
SUM FIELDS=(48,8,ZD) $ SUM ON 8 BYTES AT POS 48
OUTFIL FNAMES=CTL3CNTL, $ OUTPUT FILENAME CTL3CNTL
ENDREC=10, $ WRITE ONLY 3 RECORDS
OUTREC=(1,80) $ COPY ONLY FIRST 80 BYTES
//CTL3CNTL DD DSN=&C1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
ICE000I 0 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 11:02 ON WED FEB
OUTFIL FNAMES=OUT001,STARTREC=00000001,ENDREC=00000000
$
ICE007A F SYNTAX ERROR
OUTFIL FNAMES=OUT002,STARTREC=00000006,ENDREC=00000000
$
ICE007A F SYNTAX ERROR
ICE146I 0 END OF STATEMENTS FROM CTL3CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION LIST,MSGPRT=ALL,MSGDDN=DFSMSG,RESINV=0,SORTDD=CTL3,SORTIN=IN,D
ALLOC
SORT FIELDS=COPY
ICE052I 3 END OF DFSORT
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Feb 08, 2006 2:24 pm Post subject:
ha.rajamohamed,
your TRLR file is empty. Looks like the contents are not x'ff' for the trailer record. So Check your input file and see what the trailer looks like in the first 4 bytes.
Kolusu,
The trailer contains only the X'FF' only in its first 10 charactes,
for testing I have changed the header values from high value (X'FF') to zero
and changed the TRLR control card to
OUTFIL FNAMES=TRLR,INCLUDE=(1,4,CH,EQ,X'FF'),
Its working fine. I am puzzled now.
Also there is another file which is having a concern of 12 bytes instead of 4 bytes in header and trailer, for that file i tried the below control card, it thrown a *S0C7
abort,
Kolusu, hats of you,
Your login is working fine for the first file; for TRLR OUTFIL, I have changed the following
OUTFIL FNAMES=TRLR,INCLUDE=(1,4,CH,EQ,X'FFFFFFFF'),
Now my concern is with the second file
In the following can you please let me
//CTL1CNTL DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,12,SEQNUM,8,ZD) --> What is that 1,12 means and why we are giving it
OUTFIL FNAMES=HEAD,INCLUDE=(1,12,CH,EQ,X'00'), --> I think 1,12 are the starting position and length.
OUTREC=(C' OUTFIL FNAMES=OUT',SEQNUM,3,ZD, --> this is ok for output file name
C',STARTREC=',13,8, --> Again here what is this 13,8 stands for
C',ENDREC=00000000',80:X,SEQNUM,8,ZD) --> where this ENDREC value gets populated
OUTFIL FNAMES=TRLR,INCLUDE=(1,12,CH,EQ,C'000000000000'), --> this is fine
OUTREC=(39X,13,8,80:X,SEQNUM,8,ZD) --> why we are padding spaces and where we are padding it, than what are all the counts stands for the 39 spaces, 13,8. ..
//CTL2CNTL DD *
OPTION ZDPRINT,EQUALS
SORT FIELDS=(81,8,CH,A) --> Is this having any impacts to the above if so what it is
SUM FIELDS=(40,8,ZD) --> Is this having any impacts to the above if so what it is
OUTFIL FNAMES=CTL3CNTL,ENDREC=2,OUTREC=(1,80)
//CTL3CNTL DD DSN=&&C1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
/*
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