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.
Create an empty file using SORT.
Re: Create an empty file using SORT.
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
Nic
Re: Create an empty file using SORT.
I assume it should NOTForoXLL wrote:By empty I mean is it should have any data,
If input has "FORO", output file should be empty with RC0ForoXLL 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 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')
/*
Magesh
Re: Create an empty file using SORT.
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.
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
Nic
Re: Create an empty file using SORT.
Both the assumptions you said are correct. Missed NOT. It works for me.Magesh_j wrote:I assume it should NOTForoXLL wrote:By empty I mean is it should have any data,
If input has "FORO", output file should be empty with RC0ForoXLL 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 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
thanksCode: 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') /*
Magesh
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