IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Set Seq number at header to 1 when empty input file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 25, 2010 1:25 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Mar 25, 2010 10:01 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Mar 26, 2010 10:51 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top