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: 4649
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: 2284
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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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