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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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