|
View previous topic :: View next topic
|
| Author |
Message |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi Frank\Sri,
I have input with LRECL=10 and RECFM=FB
Want output as LRECL=10 and RECFM=FB
I am using DFSORT\ICETOOL.
Input is having some detail records needs to be grouped based on some count of records(here 5). Header and trailer is to be added for each group.
I have coded below sortcard and working fine for cases when there are some records in input dataset. But when dataset is empty spos=9,len=2 is having spaces at header since no records and hence no ID value.
I want this to come as 01 in case of empty file.
Is it possible to achieve this in same step?
Below is sortcard am using.
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(11:SEQNUM,8,ZD,
(11,8,ZD,MOD,+5),EDIT=(TT))),
IFTHEN=(WHEN=GROUP,BEGIN=(19,2,ZD,EQ,1),PUSH=(21:ID=2))
OUTFIL REMOVECC,
SECTIONS=(21,2,HEADER3=('01',DATENS=(YMD),21,2),
TRAILER3=('09',COUNT=(EDIT=(TTTTTTTT)))),
BUILD=(1,10)
/* |
Out put coming currently when input is empty
| Code: |
01100325
0900000000 |
But wha is required is
| Code: |
0110032501
0900000000 |
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Sambhaji,
You need to check for empty file and then accordingly process the header3.
Btw you don't need that much of processing to group records based on number. When=Group can do it all very easily
| Code: |
INREC IFTHEN=(WHEN=GROUP,RECORDS=5,PUSH=(11:ID=2))
|
Would put a ID of 2 bytes for every 5 records. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Thanks a lot.
I amended it and used this..
| Code: |
//S1 EXEC PGM=SORT
//SORTIN DD DSN=inputdatasetname,DISP=SHR
//SORTOUT DD DSN=&TEMP,DISP=(NEW,PASS),LRECL=10,RECFM=FB
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,RECORDS=5,PUSH=(11:ID=2))
OUTFIL REMOVECC,SECTIONS=(11,2,HEADER3=('01',DATENS=(YMD),11,2),
TRAILER3=('09',COUNT=(EDIT=(TTTTTTTT)))),BUILD=(1,10)
/*
//S2 EXEC PGM=SORT
//SORTIN DD DSN=&TEMP,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(9,2,CH,EQ,C' ',AND,1,2,CH,EQ,C'01'),
OVERLAY=(9:C'01'))
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|