I need to read data from parm and then copy it to the next line in the Output File. I have read that we can not use OUTREC to go the next line. Instead we have to use OUTFIL BUILD but when i am using OUTFIL BUILD it is going on next line but now it is not copying the data which i am passing from PARM and it is giving SYNTAX ERROR where i am using parm data in the Sort card.
You need to use OUTFIL BUILD or INREC BUILD but now if you have no records in the input then you get 0 records in the output. Google JPN and learn about the syntax as to how to use it.
Here is the IBM Link. Using JPn parameters in EXEC PARM for DFSORT
Hence, here you just need to BUILD the Header by using this way.
Thanks for providing a solution. I tried this one but it is not working.
Rohit Umarjikar wrote:
You need to use OUTFIL BUILD or INREC BUILD but now if you have no records in the input then you get 0 records in the output. Google JPN and learn about the syntax as to how to use it.
Here is the IBM Link. Using JPn parameters in EXEC PARM for DFSORT
Hence, here you just need to BUILD the Header by using this way.
Please let me know if i am missing something here.
Hi Sergeyken,
Thanks for your comment. I learned something new from your comment on my last query. But this time i am not getting where i am making Syntax mistake. As per my understanding, OUTFIL BUILD should be used to go to next line and this is what i have used but still is was getting error while i am trying to append the value i am passing through Parm (by using the method you suggested in my previous post) in one of the line. But seems like i am still missing something. So please let me know if you are aware of a way to achieve this.
The sort Card given by Rohit is not giving the error which i mentioned in my previous post. Also i got what Sergeyken was pointing about regarding Syntax error. That Syntax error has been corrected.
But by using Rohit's solution i am still getting an error, not the one which i mentioned in my previous post but an another error. Please find the description below.
Code:
ICE270I 0 PROCESSING SYMNAMES STATEMENTS
ICE280I 1 ORIGINAL STATEMENTS FROM SYSIN FOLLOW
OPTION COPY
OUTFIL HEADER1=('#',/,
'! RM -F ',JP0,/,
'QUIT')
ICE282I 0 PERFORMING SYMBOL SUBSTITUTION AS NEEDED
ICE201I 2 RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE805I 1 JOBNAME: TCOPYSEL , STEPNAME: STEP02
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5650-ZOS, Z/OS DFSORT V2R3 - 05:46 ON MON AU
OPTION COPY
OUTFIL HEADER1=('#',/,'! RM -F ',C'ITRMFILE',/,'QUIT')
ICE224A 0 SORTOUT CANNOT BE USED FOR A REPORT - RECFM WITHOUT 'A' SPECIFIED, OR
ICE751I 0 C5-BASE C6-BASE C7-BASE C8-BASE E9-I48763 E7-I49502
ICE052I 3 END OF DFSORT
While doing a copy paste , you made few syntax errors.
In your JCL in SORTIN you should have used your empty dataset name or in SORTOUT don’t provide any DCB.
BTW, additionally you missed to use SET after these syntax errors.
You already have given a reason why BUILD can not be used , regardless what you do in BUILD if the input data set is empty why on earth you would get anything in SORTOUT, isn’t that simple to understand? That’s why HEADER is used here,
I highly suggest you to go thru the manuals to know the syntax and logical stuff and make practice your self without which there is no learnings.
Fortunately, the SORT utilities do assign required DCB parameters to its output dataset unless the user has explicitly specified his own (incompatible) DCB either in DD, or in DSCB of previously created output dataset.
The simplest way to fix this is: remove explicit DCB parameter from //SORTOUT DD. Other methods are possible, but they would require a little bit more efforts.
I would have corrected the DCB error (which i actually did) but while running the jcl with OUTFIL HEADER1 it was giving syntax error before the DCB error. Hence i was asking the solution for the syntax error.
I searched for the error online which i was facing "SORTOUT CANNOT BE USED FOR A REPORT - RECFM WITHOUT 'A' SPECIFIED", in which one resolution is suggested to use REMOVECC, which i used before HEADER1 as Venkatachalamk suggested but it did not work.
But another resolution which Venkatachalamk suggested, to use FBA as RECFM worked. So thank you Rohit, Venkatachalamk & Sergeyken for sharing the knowledge and giving your time. Really appreciate it !
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
if your input is FB40 and you want FB80 output then creating FB80 output records will result in DFSort providing the 80 byte LRECL. If you do not create 80 byte records and you want FB80 output then your control statements are wrong.
If you do not create 80 byte records and you want FB80 output then your control statements are wrong.
Wrong.If you run this SORT CARD then you would see each record is suffixed with SPACES and made it to be 80 bytes records (each) , I used the IFOUTLEN=80 and OVERLAY trick to get that Fixed 80 bytes since Record#2 JP0 is dynamic which don't give us easy way to hardcode spaces.
Code:
Default for IFOUTLEN: The LRECL determined from the IFTHEN clauses.
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
Exactly. You specify sort control statements to make the LRECL match what you want. If you do not then your sort control statements are incomplete for the task required.