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

How to append data from PARM in OUTFIL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Thu Aug 22, 2019 4:03 pm
Reply with quote

Hi All,

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.

The jcl i am using :
Code:
//STEP02   EXEC PGM=SORT,PARM='JP0,"PASSDATA"'   
//SYSOUT   DD SYSOUT=*                           
//SYSPRINT DD SYSOUT=*                           
//SORTIN   DD DSN=TEST.DUMMY.FILE,DISP=SHR 
//SORTOUT  DD DSN=TEST.OUTPUT.FILE,         
//            DISP=(NEW,CATLG,DELETE),DCB=*.SORTIN
//SYSIN    DD *         
 SORT FIELDS=COPY       
 OUTFIL FIELDS=(C'#',/,
                C'! rm -f ',9:JP0,/,
                C'quit')           



The Output which i am expecting :
Code:
#
! rm -f PASSDATA
quit


The Input File has only 1 record which are spaces. Since i just want the data from PARM only so The Input File is being used just as a dummy.

Please guide me if anyone knows how this can be achieved.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Thu Aug 22, 2019 5:27 pm
Reply with quote

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.
Code:
//   SET PASSDATA='XXXX'                     
//STEP0100 EXEC PGM=SORT,PARM='JP1"&PASSDATA"'
//SYSOUT    DD  SYSOUT=*                     
//SORTLIST  DD  SYSOUT=*                     
//SORTIN DD *                                 
//SORTOUT   DD  SYSOUT=*                     
//SYSIN    DD    *                           
 OPTION COPY                                 
 OUTFIL HEADER1=('#',/,                       
                 '! RM -F ',JP1,/,           
                 'QUIT')

Output:
Code:
#           
! RM -F XXXX
QUIT   
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Aug 22, 2019 6:29 pm
Reply with quote

Members who are not able to read syntax rules from a manual are recommended to participate in the Beginners Forum.
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Mon Aug 26, 2019 2:07 pm
Reply with quote

Hi Rohit,

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.
Code:
//   SET PASSDATA='XXXX'                     
//STEP0100 EXEC PGM=SORT,PARM='JP0"&PASSDATA"'
//SYSOUT    DD  SYSOUT=*                     
//SORTLIST  DD  SYSOUT=*                     
//SORTIN DD *                                 
//SORTOUT   DD  SYSOUT=*                     
//SYSIN    DD    *                           
 OPTION COPY                                 
 OUTFIL HEADER1=('#',/,                       
                 '! RM -F ',JP1,/,           
                 'QUIT')

Output:
Code:
#           
! RM -F XXXX
QUIT   


The jcl which i ran :
Code:
//STEP02   EXEC PGM=SORT,PARM='JP0,"ITRMFILE"'         
//SYSOUT   DD SYSOUT=*                                 
//SYSPRINT DD SYSOUT=*                                 
//SORTLIST DD SYSOUT=*                                     
//SORTIN   DD *       
//SORTOUT  DD DSN=TEST.OUTPUT.FILE,               
//            DISP=(NEW,CATLG,DELETE),DCB=*.SORTIN     
//SYSIN    DD *                                       
 OPTION COPY             
OUTFIL HEADER1=('#',/,
                 '! RM -F ',JP0,/,                             
                 'QUIT')


This is the error which i am receiving :

Code:
ICE067I 0 INVALID PARAMETER IN JCL EXEC PARM OR INVOKED PARM LIST

'! RM -F ',JP0,/,
           $     
ICE007A 1 SYNTAX ERROR
'QUIT')
$     
ICE007A 1 SYNTAX ERROR   


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.
Back to top
View user's profile Send private message
Venkatachalamk

New User


Joined: 03 Mar 2017
Posts: 2
Location: India

PostPosted: Mon Aug 26, 2019 3:08 pm
Reply with quote

Hi,

You need to remove the comma in the PARM field after JP0

Regards,
Venkat
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Mon Aug 26, 2019 3:22 pm
Reply with quote

Hi Rohit & SergeyKen,

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                                                         
Back to top
View user's profile Send private message
Venkatachalamk

New User


Joined: 03 Mar 2017
Posts: 2
Location: India

PostPosted: Mon Aug 26, 2019 3:29 pm
Reply with quote

Hi,

The Error is with the DCB parameters for SORTOUT. Can you try changing the RECFM to FBA for SOROUT dataset instead of using DCB=*.SORTIN?

Alternatively you can prefix the REMOVECC statement before HEADER1 and still use RECFM FB
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Mon Aug 26, 2019 5:17 pm
Reply with quote

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.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Mon Aug 26, 2019 6:44 pm
Reply with quote

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. icon_razz.gif
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Mon Aug 26, 2019 10:44 pm
Reply with quote

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 !
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Mon Aug 26, 2019 10:49 pm
Reply with quote

You can add REMOVECC and don’t use referback. You should still able to get FB if you don’t want FBA.

Also, you don’t necessarily use SORTIN DD * that I used , you need to replace that with your original post SORTIN
Code:
 //SORTIN   DD DSN=TEST.DUMMY.FILE,DISP=SHR   
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Mon Aug 26, 2019 10:55 pm
Reply with quote

ok Thanks again Rohit. I will try this one as well and let you know the result.
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 74
Location: India

PostPosted: Tue Aug 27, 2019 12:15 pm
Reply with quote

Hi Rohit,

Rohit Umarjikar wrote:
You can add REMOVECC and don’t use referback. You should still able to get FB if you don’t want FBA.

Also, you don’t necessarily use SORTIN DD * that I used , you need to replace that with your original post SORTIN
Code:
 //SORTIN   DD DSN=TEST.DUMMY.FILE,DISP=SHR   


This worked. The below jcl i have used :
Code:
//STEP02   EXEC PGM=SORT,PARM='JP0"ITRMFILE"'   
//SYSOUT   DD SYSOUT=*                           
//SYSPRINT DD SYSOUT=*                           
//SORTIN   DD *                                 
//SORTOUT  DD DSN=TEST.OUTPUT.FILE,         
//            DISP=(NEW,CATLG,DELETE),           
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0) 
//SYSIN    DD *                                 
 OPTION COPY                                     
 OUTFIL REMOVECC,                               
 TRAILER1=('#',/,                               
           '! RM -F ',JP0,/,                     
           'QUIT')                               
/*


The Output i received :
Code:
#               
! RM -F ITRMFILE
QUIT           


Thanks for all the guidance.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Aug 27, 2019 12:53 pm
Reply with quote

Once again, do not use DCB on your output dataset. DFSort can do a much better job of assigning the values than you can.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Aug 28, 2019 2:49 am
Reply with quote

Quote:
Once again, do not use DCB on your output dataset. DFSort can do a much better job of assigning the values than you can.
Not really. If the input Data Set is FB 40 then you don't get output FB 80 but only FB 40 and if you specify LRECL=80 then you would get error.

For your any input LRECL you can use to make out LRECL to always have FB 80.
Code:

//SYSIN    DD *                     
 OPTION COPY                         
 OUTFIL IFOUTLEN=80,                 
 IFTHEN=(WHEN=INIT,OVERLAY=(1:80X)),
 HEADER1=('#',/,                     
          '! RM -F ',JP0,/,         
          'QUIT'),REMOVECC
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Aug 28, 2019 2:03 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Aug 28, 2019 7:38 pm
Reply with quote

Quote:
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.

There might be many ways but this one is one way.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Aug 28, 2019 8:43 pm
Reply with quote

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.
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top