Page 1 of 1

How to pass used id inside sysin dd *?

PostPosted: Thu Jun 07, 2012 12:58 pm
by lopa patro
I need to pass userid to a proc through sysin .Can anyone pls provide me the syntax?
Thanks in advance.

Re: How to pass used id inside sysin dd *?

PostPosted: Thu Jun 07, 2012 2:09 pm
by halfteck
If by 'userid' you mean any character string, and if by 'inside SYSIN DD' you mean a //SYSIN DD *, then the syntax you should be checking on is 'overriding a DD statement within a procedure' .

Or

//stepname.SYSIN DD *
userid (or any other text you require)

Re: How to pass used id inside sysin dd *?

PostPosted: Thu Jun 07, 2012 4:08 pm
by Akatsukami
lopa patro wrote:I need to pass userid to a proc through sysin .Can anyone pls provide me the syntax?
Thanks in advance.

As you should know, symbolics are not resolved in in-stream data. Either generate a small data set containing needed input in a prior step, or pass it as a parameter.

Re: How to pass used id inside sysin dd *?

PostPosted: Thu Jun 07, 2012 7:54 pm
by Monitor
My assumption is that you also want to write a program to receive the userid. If you pass the userid as a Parm-value to the program like this:
//STEP1   EXEC PGM=MYPGM,PARM=&SYSUID

you can easily get hold of the value in a COBOL-program like this:
000100  id division.                                 
000200  Program-id. PGM1.                           
000300  Data Division.                               
000400  Linkage Section.                             
000500  01 Parm1.                                   
000600    05 Plen  Pic S9(04) Binary.               
000700    05 Pdata Pic x(10).                       
000800  Procedure Division using Parm1.             
000900      If Plen = 0                             
001000         Display 'Parameter missing'           
001100      Else                                     
001200         Display 'Parameter >> ' Pdata(1:Plen)
001300      End-If                                   
001400      Goback                                   
001500      .                                       

With this solution there is no need to enter the data/userid in a file, and the value is always the correct value, as long as you just code the parm.

Re: How to pass used id inside sysin dd *?

PostPosted: Fri Jun 08, 2012 12:10 pm
by lopa patro
Thanks for ur reply guys..

Below is my requirement.
//DELETE EXEC PGM=IDCAMS,REGION=256K
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE AH1216A.GOTCOPY.IMS0.TOIMSO NONVSAM SCRATCH PURGE
IF LASTCC > 0 THEN SET MAXCC = 0

I need to delete a dataset 'AH1216A.GOTCOPY.IMS0.TOIMSO' where AH1216A is the RACF id of the user.

Re: How to pass used id inside sysin dd *?

PostPosted: Fri Jun 08, 2012 12:56 pm
by prino
Are you thick or just pretending?

You've been told that you cannot use symbolics in sysin, and here you go again with the same requirement...

You've been told to write a program that writes the required data to a (temporary) file that is read by IDCAMS.

Now go away and do what you have been told to do!

Re: How to pass used id inside sysin dd *?

PostPosted: Fri Jun 08, 2012 7:08 pm
by steve-myers
As Prino, Monitor and others have said, you cannot do symbol substitution in data.

If you think outside the box, you can do what you want to do other ways. This will always work.
//A       EXEC PGM=IKJEFT01,
// PARM='DEL ''&SYSUID..GOTCOPY.IMS0.TOIMSO'' NONVSAM PURGE SCRATCH'
//SYSTSPRT DD  SYSOUT=*
//SYSTSIN  DD  DUMMY
The TSO DELETE command is sort of an alias for the IDCAMS DELETE command and takes the same parameters, and it is not widely appreciated that the JCL PARM for the TSO Terminal Monitor Program is treated as a TSO command.

Now, of course, as you have probably noted, there is a space problem here: it may not be possible to fit the JCL PARM into a single JCL line, but you can remove the default SCRATCH parameter and you probably do not need the NONVSAM parameter, and you can use JCL symbols, like this -
//TSODEL  PROC D='?'
//A       EXEC PGM=IKJEFT01,
// PARM='DEL ''&SYSUID..&D'' PURGE'
//SYSTSPRT DD  SYSOUT=*
//SYSTSIN  DD  DUMMY
//        PEND
//EXEC    EXEC TSODEL,D='GOTCOPY.IMS0.TOIMSO'


Of course, there is the simpler solution -
//A       EXEC PGM=IKJEFT01
//SYSTSPRT DD  SYSOUT=*
//SYSTSIN  DD  *
 DEL GOTCOPY.IMS0.TOIMSO NONVSAM PURGE
TSO will insert your userid for you!