Create an empty file using SORT.

IBM's Sort Product, ICETOOL, ICEMAN and ICEGENER.
Post Reply
ForoXLL
New Member
Posts: 4
Joined: Thu May 19, 2016 2:37 pm

Create an empty file using SORT.

Post by ForoXLL »

Hi,

Can we Create an empty file using SORT? By empty I mean is it should have any data, it should not be like having a record with sapces but just no record. And it should have based on a condition. Like, if in the input file if we have a string "FORO" somewhere in the record, output file should be empty else it should end with RC=8? Please help how can I do this.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Create an empty file using SORT.

Post by nicc »

What have you tried so far? Did you try INCUDing non-existent records only? Have you looked up in the manual as to when you can influence the return code?
Regards
Nic
User avatar
Magesh_j
Registered Member
Posts: 33
Joined: Sun Sep 04, 2016 8:50 pm

Re: Create an empty file using SORT.

Post by Magesh_j »

ForoXLL wrote:By empty I mean is it should have any data,
I assume it should NOT
ForoXLL wrote:if in the input file if we have a string "FORO" somewhere in the record, output file should be empty else it should end with RC=8? Please help how I can do this.
If input has "FORO", output file should be empty with RC0
If the input doesn't have "FORO", the output should be empty with RC8.

If my understanding of the requirement is right, following code may help you.

Assuming LREC=80

Code: Select all

//CPYJK EXEC PGM=ICETOOL                                                
//TOOLMSG DD SYSOUT=*                                                   
//SYSOUT DD SYSOUT=*                                                    
//DFSMSG DD SYSOUT=*                                                    
//IN1 DD your input file FB/80
//OUT2 DD DSN=OUTPUT.FILE,DISP=(,CATLG,DELETE),                         
//            SPACE=(CYL,(1,1),RLSE),DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)  
//TOOLIN DD *                                                           
  COUNT FROM(IN1) USING(CNT1) RC8 EMPTY                                 
//CNT1CNTL DD *                                                         
  INCLUDE COND=(1,80,SS,EQ,C'FORO')                                     
/*                                                                      
thanks
Magesh
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Create an empty file using SORT.

Post by nicc »

I think that shout be OMIT rather than INCLUDE as he wants an empty file - but it depends on interpretation. I think he does NOT want 'FORO'.

But if he has a data set with different types of records in it, and not all types will be present every time, and he wants to extract certain types, which may or may not be there, and he wants an RC of 8 when none of those specific records are present: then INCLUDE is right.
Regards
Nic
ForoXLL
New Member
Posts: 4
Joined: Thu May 19, 2016 2:37 pm

Re: Create an empty file using SORT.

Post by ForoXLL »

Magesh_j wrote:
ForoXLL wrote:By empty I mean is it should have any data,
I assume it should NOT
ForoXLL wrote:if in the input file if we have a string "FORO" somewhere in the record, output file should be empty else it should end with RC=8? Please help how I can do this.
If input has "FORO", output file should be empty with RC0
If the input doesn't have "FORO", the output should be empty with RC8.

If my understanding of the requirement is right, following code may help you.

Assuming LREC=80

Code: Select all

//CPYJK EXEC PGM=ICETOOL                                                
//TOOLMSG DD SYSOUT=*                                                   
//SYSOUT DD SYSOUT=*                                                    
//DFSMSG DD SYSOUT=*                                                    
//IN1 DD your input file FB/80
//OUT2 DD DSN=OUTPUT.FILE,DISP=(,CATLG,DELETE),                         
//            SPACE=(CYL,(1,1),RLSE),DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)  
//TOOLIN DD *                                                           
  COUNT FROM(IN1) USING(CNT1) RC8 EMPTY                                 
//CNT1CNTL DD *                                                         
  INCLUDE COND=(1,80,SS,EQ,C'FORO')                                     
/*                                                                      
thanks
Magesh
Both the assumptions you said are correct. Missed NOT. It works for me.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DFSort, ICETOOL, ICEMAN, ICEGENER.”