Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to append data from PARM in OUTFIL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 71
Location: India

PostPosted: Thu Aug 22, 2019 4:03 pm    Post subject: How to append data from PARM in OUTFIL
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

Senior Member


Joined: 21 Sep 2010
Posts: 2299
Location: NY,USA

PostPosted: Thu Aug 22, 2019 5:27 pm    Post subject:
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

Active Member


Joined: 29 Apr 2008
Posts: 609
Location: Maryland

PostPosted: Thu Aug 22, 2019 6:29 pm    Post subject:
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: 71
Location: India

PostPosted: Mon Aug 26, 2019 2:07 pm    Post subject:
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    Post subject:
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: 71
Location: India

PostPosted: Mon Aug 26, 2019 3:22 pm    Post subject:
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    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2299
Location: NY,USA

PostPosted: Mon Aug 26, 2019 5:17 pm    Post subject:
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

Active Member


Joined: 29 Apr 2008
Posts: 609
Location: Maryland

PostPosted: Mon Aug 26, 2019 6:44 pm    Post subject:
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: 71
Location: India

PostPosted: Mon Aug 26, 2019 10:44 pm    Post subject: Reply to: How to append data from PARM in OUTFIL
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

Senior Member


Joined: 21 Sep 2010
Posts: 2299
Location: NY,USA

PostPosted: Mon Aug 26, 2019 10:49 pm    Post subject:
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: 71
Location: India

PostPosted: Mon Aug 26, 2019 10:55 pm    Post subject:
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: 71
Location: India

PostPosted: Tue Aug 27, 2019 12:15 pm    Post subject:
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: 2247
Location: Hampshire, UK

PostPosted: Tue Aug 27, 2019 12:53 pm    Post subject: Reply to: How to append data from PARM in OUTFIL
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

Senior Member


Joined: 21 Sep 2010
Posts: 2299
Location: NY,USA

PostPosted: Wed Aug 28, 2019 2:49 am    Post subject:
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: 2247
Location: Hampshire, UK

PostPosted: Wed Aug 28, 2019 2:03 pm    Post subject: Reply to: How to append data from PARM in OUTFIL
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

Senior Member


Joined: 21 Sep 2010
Posts: 2299
Location: NY,USA

PostPosted: Wed Aug 28, 2019 7:38 pm    Post subject:
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: 2247
Location: Hampshire, UK

PostPosted: Wed Aug 28, 2019 8:43 pm    Post subject: Reply to: How to append data from PARM in OUTFIL
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extract data from n DB2 Views automat... esmeraldo All Other Mainframe Topics 4 Wed Nov 13, 2019 12:32 am
No new posts adrdssu for copy all data robyjhl JCL & VSAM 5 Tue Nov 12, 2019 11:17 pm
No new posts Convert mainframe data to .csv format... karan_reddy DFSORT/ICETOOL 10 Sat Nov 02, 2019 2:09 am
No new posts How to place name of the file where t... danielgp89 SYNCSORT 18 Thu Oct 17, 2019 12:55 am
No new posts How to force ISPF to allocate ISPF te... Michele Giannuli TSO/ISPF 9 Thu Sep 12, 2019 2:03 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us