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

GENERATE EMPTY OUPUT FILE USING ICETOOL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Dec 16, 2008 2:57 pm
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
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
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 Developer


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

PostPosted: Tue Dec 16, 2008 10:45 pm
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
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
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
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
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 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 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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top