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

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


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Feb 17, 2009 5:32 pm
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Feb 17, 2009 5:48 pm
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Feb 17, 2009 6:33 pm
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
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

Global Moderator


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

PostPosted: Tue Feb 17, 2009 7:12 pm
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
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
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: 400
Location: Mumbai

PostPosted: Wed Feb 18, 2009 2:29 am
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: 2481
Location: @my desk

PostPosted: Wed Feb 18, 2009 9:58 am
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: 400
Location: Mumbai

PostPosted: Wed Feb 18, 2009 10:15 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top