Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Set Seq number at header to 1 when empty input file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Set Seq number at header to 1 when empty input file
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us