Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to copy variable defined in jcl into a flat file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Feb 17, 2009 5:27 pm    Post subject: How to copy variable defined in jcl into a flat file.
Reply with quote

Hi all,
i need copy a variable defined in the jcl into a 80byte flate file. i tried to use sort but failed.

for example,
Code:

//  set HOST='10.0.858.88'
//*i need to copy &HOST into a 80byte file.


thanks,
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Feb 17, 2009 5:32 pm    Post subject:
Reply with quote

Quote:
i tried to use sort but failed.


Well, not being psychic I can not see either your SORT statement or the output from the SORT step.

Perhaps if you bothered to post the relevent information people would be able to help you.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Feb 17, 2009 5:38 pm    Post subject:
Reply with quote

Basically i need to copy the variable into a flat file. i used sort but not sure if that i a valid. please let me know how to copy the variable value into a flat file.

Code:

//SORTIN   DD *                                       
  &HOST                                               
/*                                                     
//SORTOUT  DD DSN=X.Y.Z,                 
//            DISP=(NEW,CATLG,DELETE),                 
//            SPACE=(TRK,(1,1),RLSE),               
//            DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)     
//SYSIN    DD *                                       
     SORT FIELDS=COPY                                 
/* 
                                                   
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Feb 17, 2009 5:48 pm    Post subject:
Reply with quote

You can not use symbolic substitutiions in instream, as used in your sysin.

These will not be substituted
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Feb 17, 2009 5:58 pm    Post subject:
Reply with quote

Ok. is there any way or utility to capture the value of that variable into a 80 byte file.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Feb 17, 2009 6:33 pm    Post subject:
Reply with quote

Try this
Code:

//SORTIN   DD DSN=where your JCL is,DISP=SHR
//SYSIN    DD *                   
 SORT FIELDS=COPY                 
 INCLUDE COND=(1,80,SS,EQ,C'HOST')
/*                               
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Feb 17, 2009 6:45 pm    Post subject:
Reply with quote

Hi expat,
i tried your code but i'm not geting the desired output. I got the following output

Code:

//         SET HOST='123.456.789'   




But i only need the value.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Feb 17, 2009 7:12 pm    Post subject: Reply to: How to copy variable defined in jcl into a flat fi
Reply with quote

I'm not aware of any standard utility that will let you pass a parm value from the JCL into an output dataset. If your site has a need to do this, then I'd suggest that you have your own in-house utility coded up to accomplish this task. You could, of course, easily accomplish this with any number of langauges or tools, such as COBOL/Assembler/PLI/REXX/CLIST/SAS/Easytrieve, etc.

Certainly easily doable with REXX:

Code:

//*                                                         
//  SET HOST='10.0.858.88'                                 
//*                                                         
//STEP0001 EXEC PGM=ICEGENER                               
//SYSUT1   DD   *,DLM=@@                                   
PUSH ARG(1)                                                 
"EXECIO 1 DISKW OUT (FINIS"                                 
EXIT 0                                                     
@@                                                         
//SYSUT2   DD   DSN=&&PDS(X),DISP=(,PASS),UNIT=VIO,         
//         SPACE=(TRK,(1,1,1),RLSE)                         
//SYSPRINT DD   SYSOUT=*                                   
//SYSIN    DD   DUMMY                                       
//*                                                         
//STEP0002 EXEC PGM=IRXJCL,PARM='X &HOST'                   
//SYSEXEC  DD   DSN=&&PDS,DISP=(OLD,DELETE)                 
//SYSTSPRT DD   SYSOUT=*                                   
//SYSTSIN  DD   DUMMY                                       
//OUT      DD   SYSOUT=*,RECFM=FB,LRECL=80                 
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Tue Feb 17, 2009 10:53 pm    Post subject:
Reply with quote

Hi,

I agree with Kevin. Utility to copy Symbolic Parameters vary from sit to site. At our site we use following utility

Code:

//SET1 SET HOST='10.0.858.88'
//STEPCPY  EXEC PGM=K9801GCP,             
//         PARM=(,SFILE,&HOST)                   
//                     
//SFILE     DD  DSN=&&TEMP,DISP=(NEW,PASS)
//SYSPRINT  DD SYSOUT=&CLS


Note: I have used a temporary file, which can be replaced with actual DSN


Cheers!!
Happy Coding
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Feb 17, 2009 11:57 pm    Post subject:
Reply with quote

Thanks for the help. But one think that i though is to write a small program, pass the value as a parm then write it to output file. this can be done in no time. But anyhow will try to find if any such utility is available in my shop.

thanks for your time and help.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Wed Feb 18, 2009 2:29 am    Post subject: Reply to: How to copy variable defined in jcl into a flat fi
Reply with quote

One simple approach:
Code:
//   SET HOST='10.11.12.13'
//CREATE   EXEC PGM=IEBGENER
//SYSUT1   DD  *
  Queue Arg(1)
  'EXECIO 1 DISKW OUT (FINIS'
  Return rc
//SYSUT2   DD  DISP=(,PASS),DSN=&&EXEC(MYEXEC),SPACE=(TRK,(1,1,1))
//SYSPRINT DD  DUMMY
//SYSIN    DD  DUMMY
//*---------------------------------------------------------------
//WRITE    EXEC PGM=IKJEFT01,PARM='%MYEXEC &HOST'
//SYSEXEC  DD  DISP=(OLD,PASS),DSN=&&EXEC
//OUT      DD  DISP=OLD,DSN=MBB1986.OUTPUT.FILE
//SYSTSIN  DD  DUMMY
//SYSTSPRT DD  DUMMY

drop the 1st step if your exec is already in a pds soomewhere
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2181
Location: @my desk

PostPosted: Wed Feb 18, 2009 9:58 am    Post subject:
Reply with quote

Quote:
One simple approach:
MBabu,

Is this different from the solution which Kevin had already posted? icon_rolleyes.gif
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Wed Feb 18, 2009 10:15 am    Post subject:
Reply with quote

arcvns wrote:
Is this different from the solution which Kevin had already posted? icon_rolleyes.gif
No. I just wasn't paying attention icon_redface.gif
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us