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
 

 

GENERATE EMPTY OUPUT FILE USING ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Tue Dec 16, 2008 2:42 pm    Post subject: GENERATE EMPTY OUPUT FILE USING ICETOOL
Reply with quote

HI,
my logic generates a trailer record when input files are empty..

could it be modified so that ouput file be empty ie., it should not contain even the trailer record...

Code:

  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'01'),           
     BUILD=(1,201,202:C'1',203:2C'0')),             
   IFTHEN=(WHEN=(1,2,CH,EQ,C'02'),                 
     BUILD=(1,201,202:C'0',203:C'1',204:C'0')),     
   IFTHEN=(WHEN=(1,2,CH,EQ,C'03'),                 
     BUILD=(1,201,202:2C'0',204:C'1'))               
  OUTFIL FNAMES=FOUT,                             
    INCLUDE=(1,2,CH,NE,C'99'),                     
    TRAILER1=(C'99',TOT=(202,1,ZD,M11,LENGTH=8),   
       TOT=(203,1,ZD,M11,LENGTH=8),                   
       TOT=(204,1,ZD,M11,LENGTH=8),                   
         COUNT+1=(M11,LENGTH=9)),REMOVECC,               
       OUTREC=(1,201)
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Dec 16, 2008 2:57 pm    Post subject:
Reply with quote

What about conditional execution

STEP1 - Check file empty / not empty

If file empty - run step to create null file & skip sort step

If file not empty - skip create null file step and execute sort step
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Tue Dec 16, 2008 2:59 pm    Post subject: Reply to: GENERATE EMPTY OUPUT FILE USING ICETOOL
Reply with quote

Could there be some logic in the OUTFIL step where the trailer is written only if the total record count in the output file is more than 2 ?
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Tue Dec 16, 2008 3:02 pm    Post subject:
Reply with quote

hi expat,

could you pls give me the code on how to execute this conditional statement
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Dec 16, 2008 10:45 pm    Post subject:
Reply with quote

Quote:
Could there be some logic in the OUTFIL step where the trailer is written only if the total record count in the output file is more than 2 ?


There are no built-in functions for conditionally writing a trailer record. The trailer1 record is always written. You'll need to separately check for an empty or non-empty data set.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Dec 17, 2008 2:40 am    Post subject: Re: Reply to: GENERATE EMPTY OUPUT FILE USING ICETOOL
Reply with quote

essence21 wrote:
Could there be some logic in the OUTFIL step where the trailer is written only if the total record count in the output file is more than 2 ?


There is an alternative way to get the results but it is based on an assumption that your input has only 1 '99' record which is the last record, here is DFSORT JCL which will take care of empty files as well but generate the desired results.

Code:

//STEP0100 EXEC PGM=ICEMAN                           
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                     
01                                                   
02                                                   
02                                                   
03                                                   
03                                                   
03                                                   
04                                                   
05                                                   
05                                                   
05                                                   
05                                                   
05                                                   
06                                                   
99                                                   
//FOUT     DD SYSOUT=*                               
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   

  INREC IFTHEN=(WHEN=INIT,OVERLAY=(226:SEQNUM,8,ZD)),
  IFTHEN=(WHEN=(1,2,SS,EQ,C'01,99'),                 
  OVERLAY=(202:SEQNUM,8,ZD),HIT=NEXT),               
  IFTHEN=(WHEN=(1,2,SS,EQ,C'02,99'),                 
  OVERLAY=(210:SEQNUM,8,ZD),HIT=NEXT),               
  IFTHEN=(WHEN=(1,2,SS,EQ,C'03,99'),                 
  OVERLAY=(218:SEQNUM,8,ZD))                         
                                                     
  OUTFIL FNAMES=FOUT,IFOUTLEN=201,                   
  IFTHEN=(WHEN=(1,2,CH,EQ,C'99'),                   
  OVERLAY=(03:202,8,ZD,SUB,+1,M11,LENGTH=8,         
              210,8,ZD,SUB,+1,M11,LENGTH=8,         
              218,8,ZD,SUB,+1,M11,LENGTH=8,         
              226,8,201:X))                         
/*



The output from this job is

Code:

01                               
02                               
02                               
03                               
03                               
03                               
04                               
05                               
05                               
05                               
05                               
05                               
06                               
9900000001000000020000000300000014
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Wed Dec 17, 2008 9:41 am    Post subject:
Reply with quote

Quote:
There is an alternative way to get the results but it is based on an assumption that your input has only 1 '99' record which is the last record, here is DFSORT JCL which will take care of empty files as well but generate the desired results


That should help me out. But let me explain what my code aims to achieve...
i have 2 files A and B. I need to create a file C which is basically A-B.

I used ICETOOL to achieve for splicing. That left only the trailer record to be generated which i did as follows.

00xxxxxx (Header)
01xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
01xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
02xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
03xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
9900000002000000010000000100000006

record length is 201.
As given in my code above,
Using Build in inrec records with 01 were appended 100 from 202 to 204 posn. Similarly 02 records with 010 and 03 with 001..
Initially the requirement said that files A, B even if empty would contain header and trailer records. My logic works fine here.
Now req says that if A,B are absolutely empty C should also be empty.
here my logic failed as it generated the trailer..
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Dec 17, 2008 10:17 pm    Post subject:
Reply with quote

essence21,

Show me your SPLICE Job with DCB Properties of both files involved, key information , sample input from both files and desired output and I will show you a way to do it in splice job itself
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Mon Dec 29, 2008 5:08 pm    Post subject: Reply to: GENERATE EMPTY OUPUT FILE USING ICETOOL
Reply with quote

icon_biggrin.gif

Sorry for the delay in replying; was on leave.

Its ok skolusu ;

Using your method in my code worked out perfectly

Thanks again !!
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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