Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
passing symbolic parameter in sysin dd statement

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

New User


Joined: 31 Aug 2006
Posts: 57
Location: chennai

PostPosted: Wed Sep 13, 2006 10:50 am    Post subject: passing symbolic parameter in sysin dd statement
Reply with quote

Hi..
I Want to check whether the data is already exist or not..
with the help of listcat (IDCAMS), we can check it.
But i want to pass a DSN to the utility using symbolic parameter.

For example :
listcat('myuser. checkdsn.idcams') -it is possible

But My requirement is
listcat('&client..checkdsn.idcams')

How to check the dsn by this way??

Plz let me know if any one know the answer

Thanks in Advance..
Back to top
View user's profile Send private message

jaisai

New User


Joined: 13 Sep 2006
Posts: 2

PostPosted: Wed Sep 13, 2006 1:55 pm    Post subject: Re: passing symbolic parameter in sysin dd statement
Reply with quote

Code:
Symbolic parameter
DSNAME='Your file'

//STEP0100 EXEC PGM=IDCAMS     
//INDD     DD DSN=&DSNAME,                 
//            DISP=SHR                 
//SYSIN *
listcat(INDD)
/*
       
Back to top
View user's profile Send private message
mkssampathkumar
Warnings : 1

New User


Joined: 31 Aug 2006
Posts: 57
Location: chennai

PostPosted: Wed Sep 13, 2006 4:30 pm    Post subject:
Reply with quote

Hi..
Thanks for ur reply..
I tried with ur code and also hardcoded in dd statement..

//STEP010 EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//FILEIN DD DSN=sam.T.CHKEMPTY,DISP=SHR
//SYSIN DD *
LISTCAT ENTRIES(FILEIN)
/*
//
i tried with above code also ,this is also not working
Am gettint error 'Data set not found'( jcl error).
if i give the dsn name directly in listcat ,the code is executing.
i.e.
LISTCAT ENTRIES('sam.T.CHKEMPTY')
the above code is executing..

please let me know the reason..
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Wed Sep 13, 2006 6:17 pm    Post subject: Re: passing symbolic parameter in sysin dd statement
Reply with quote

mkssampathkumar, from what I can tell from your original post, you have two issues to deal with.

First, you want to check if a dataset exists (i.e. is cataloged) or not. If a dataset is not cataloged, then you can't refer to it in the JCL with a DISP=SHR or DISP=OLD disposition without incurring a JCL error (dataset not found).

Second, you want to use a symbolic parameter for a part of the dataset name.

Personally, my preference is always to have a step that catalogs the dataset using DISP=(MOD,CATLG), so if it's already cataloged, fine. If it's not, then it will be.

If you just want to check for it's existence, then you'll need to pass the dataset name to a program as a PARM, and then let the program call the LISTCAT function and interpret the results. The pseudo-code would be:
Code:

//STEPX EXEC PGM=mypgm,PARM='&CLIENT..CHECKDSN.IDCAMS'
//SYSPRINT DD SYSOUT=*
//*

where mypgm would then call LISTCAT
GET theparm
LISTCAT ENT(theparm)
Check the LISTCAT Return-Code
Back to top
View user's profile Send private message
mkssampathkumar
Warnings : 1

New User


Joined: 31 Aug 2006
Posts: 57
Location: chennai

PostPosted: Thu Sep 14, 2006 10:24 am    Post subject:
Reply with quote

Hi Kevin
Thanks for ur reply..

DISP=(MOD,CATLG),
The above code which u reffered by u is creating the file which is not already present.

But the file which am checking is input file .so am not having rights to create the file. .

And second one is

//STEP010 EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES('sam.T.CHKEMPTY')
//


The above code is executed successfully and returning the maxcc 4.

But my problem is

//STEP010 EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//FILEIN DD DSN=sam.T.CHKEMPTY,DISP=SHR
//SYSIN DD *
LISTCAT ENTRIES(FILEIN)
/*
//
and

//STEP010 EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//FILEIN DD DSN=(&&dsname..T.CHKEMPTY),DISP=SHR
//SYSIN DD *
LISTCAT ENTRIES(FILEIN)
/*
i tried with both the codes..

Both the codes are giving JCL error.

And more doubt am having in ur code

1.Did u using LISTCAT in procedurs called 'MYPGM'??

2.Without IDCAMS utility,can we use LISTCAT..


AM not clear in ur code which comes after
[b]"where mypgm would then call LISTCAT"[/b]

i want to check the existence of input file which is used in my pgm thru jcl without getting error..
this is my requirement..how can i do it?
if my pgm doesn find the required input file then i have to write error message in output file
i want to check the existence of input file .
if my pgm doesn find the required input file then i have to write error message in output file.
I think am clear in my question??

Thanks
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Fri Sep 15, 2006 1:38 am    Post subject: Re: passing symbolic parameter in sysin dd statement
Reply with quote

I'm not sure why you're insisting on doing this within a jobstream when that's not possible.

Here's an option:
Code:

//STEP0001 EXEC PGM=CHECKDSN,PARM='&CLIENT..CHECKDSN.IDCAMS'         
//STEPLIB  DD   DISP=SHR,DSN=&SYSUID..COBOL.LOAD                     
//SYSIN    DD   UNIT=VIO,DISP=(,DELETE),RECFM=FB,LRECL=80             
//SYSPRINT DD   SYSOUT=*                                             
//*                                                                   
//STEP0002 EXEC PGM=IKJEFT01,PARM='%CHECKDSN &CLIENT..CHECKDSN.IDCAMS'
//SYSPROC  DD   DISP=SHR,DSN=&SYSUID..CLIST                           
//SYSTSIN  DD   DUMMY                                                 
//SYSTSPRT DD   SYSOUT=*                                             
//*                                                                   
//STEP0003 EXEC PGM=IKJEFT01,PARM='%CHECKDSN &CLIENT..CHECKDSN.IDCAMS'
//SYSPROC  DD   DISP=SHR,DSN=&SYSUID..REXX                           
//SYSTSIN  DD   DUMMY                                                 
//SYSTSPRT DD   SYSOUT=*                                             
//*                                                                   


where:

Code:

COBOL:

       IDENTIFICATION DIVISION.                               
       PROGRAM-ID. CHECKDSN.                                 
                                                             
       ENVIRONMENT DIVISION.                                 
       INPUT-OUTPUT SECTION.                                 
                                                             
         FILE-CONTROL.                                       
           SELECT SYSIN-FILE ASSIGN TO UT-S-SYSIN             
             ORGANIZATION IS SEQUENTIAL                       
             ACCESS IS SEQUENTIAL.                           
                                                             
       DATA DIVISION.                                         
       FILE SECTION.                                         
                                                             
       FD  SYSIN-FILE                                         
           LABEL RECORD STANDARD                             
           BLOCK 0 RECORDS                                   
           RECORDING MODE F                                   
           RECORD CONTAINS 80 CHARACTERS.                     
       01 SYSIN-RECORD                 PIC X(80).             
                                                                 
       WORKING-STORAGE SECTION.                                   
                                                                 
       LINKAGE SECTION.                                           
       01  PARM.                                                 
           03  PARM-LENGTH             PIC S9(04) COMP SYNC.     
           03  THE-PARM.                                         
               05  THE-DATASET-NAME    PIC X(44).                 
                                                                 
       PROCEDURE DIVISION USING PARM.                             
           INSPECT THE-PARM                                       
             REPLACING ALL LOW-VALUES BY SPACES.                 
           DISPLAY THE-PARM.                                     
           OPEN OUTPUT SYSIN-FILE.                               
           MOVE SPACES TO SYSIN-RECORD.                           
           STRING '  LISTCAT ENT('                               
             DELIMITED BY SIZE                                   
               THE-DATASET-NAME                                   
             DELIMITED BY SPACES                                 
               ') ALL'                                           
             DELIMITED BY SIZE                                   
               INTO SYSIN-RECORD.                                 
           WRITE SYSIN-RECORD.                 
           CLOSE SYSIN-FILE.                   
           CALL 'IDCAMS'.                       
           STOP RUN.                           


Code:

CLIST:

PROC 1 THEDSN                         
LISTCAT ENT('&THEDSN') ALL             
EXIT CODE(&LASTCC)                     


Code:

REXX:

/* REXX */                             
"LISTCAT ENT('"ARG(1)"') ALL"         
EXIT RC                               
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Fri Sep 15, 2006 1:48 am    Post subject: Re: passing symbolic parameter in sysin dd statement
Reply with quote

jaisai, that syntax you gave for LISTCAT is WRONG.

Last I knew, the command LISTCAT FILE('dname')
Quote:

Identifies the volumes that contain the catalog
entries to be listed. 'dname' is the name of the DD statement that identifies the volumes
containing catalog entries to be listed.
Back to top
View user's profile Send private message
mkssampathkumar
Warnings : 1

New User


Joined: 31 Aug 2006
Posts: 57
Location: chennai

PostPosted: Fri Sep 15, 2006 12:43 pm    Post subject:
Reply with quote

Hi kevin.

Thanks for ur effort..

Actaullay my programming language is not a cobol.

Am working in SAS..and also am having an option to do in programming language and also i solved too.
But my requirement is wheteher we can check the file existance in jcl itself without help of programming language..

listcat entries('dsname.t.xxx')
(its working very fine without any parm parameter and programming language )

Like that is there any option to find the file name with symbolic parameter.
this is my requrement..

i thougt someone may know the answer..
to find the file existance in jcl is not possible,plz let me know..

Thanks..
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Fri Sep 15, 2006 1:26 pm    Post subject:
Reply with quote

Hi mkssampathkumar !

You have to use instream-procedure JCL with the above IDCAMS, so that the ampersand-variable is interpreted.

Also you can use IEFBR14 with allocating the DSN as NEW,CATLG.
By returning a NOT-CATLG2-Error, the file exists.


Regards, UmeySan
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Fri Sep 15, 2006 1:44 pm    Post subject:
Reply with quote

hi UmeySan,

You you please share the idea of Insteam Procedure to interpret '&' ??

As of my knowledge we can;t have symbolic parms in SYSIN.

SYSIN is a going to be input to the program AS IT IS.
It is not going to make sense to have a Symbolic parmeter.


~Vamsi
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Fri Sep 15, 2006 3:45 pm    Post subject:
Reply with quote

Hi shreevamsi,

as you could se below, i use instream procs with &-variables within normal
JCL-Statements and in Sysin-DD.

Regards, UmeySan


000300 //*
000310 //* BESTANDSDRUCK ISTITUT = &UINR. KONTO = &UKNR.
000320 //*
000700 //STEP010 EXEC P441G&UGRP.,
000800 // GEN='*',
001000 // INR=&UINS.
001100 //BEST.KARTE DD *
001200 $$
001300 S000 6
001400 S673 &UKNR.
001500 NO ISATZ
001800 //BEST.LSTDCB DD SYSOUT=*
001900 //BEST.SSD DD DISP=SHR,DSN=&UHLQ..I&UINS..GL00.SSD
002100 //BEST.OFFSET3 DD DUMMY
Back to top
View user's profile Send private message
mkssampathkumar
Warnings : 1

New User


Joined: 31 Aug 2006
Posts: 57
Location: chennai

PostPosted: Fri Sep 15, 2006 4:45 pm    Post subject:
Reply with quote

hi UmeySan

Thanks for ur post..
AM having some doubt in ur coding.

//STEP010 EXEC P441G&UGRP.,

In the above step u r calling some user defined procedure and passing some values as symbolic parameter ..

//BEST.KARTE DD *
This is the sysin statement.
here u passing some values to ur user defined procedures..
after that u overriding some values in that procedure..


I CANT UNDERSTAND UR CODING..can u explain little more?


Is it possible to send a instream data in procedurs???
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Fri Sep 15, 2006 5:35 pm    Post subject:
Reply with quote

hi Sampath,

According to UmeySan Code,

That was a Proc which was called by a Job with overrides to the Symbolic Parameters.

All the &symboles will be substitued by the Values specified in the Job.

Thanks UmeySan. I learned a new thing today..I will be checking this and let you know iff any observations.

~Vamsi
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Fri Sep 15, 2006 5:52 pm    Post subject:
Reply with quote

Hi mkssampathkumar !

Let's suppose we have to process data for several groups of our company. All these groups have several institutes. These Institus have several departments.

To handle all our processes against all the data of these groups with a lot of instituts, wich will have a lot of departments, with a minimum of JCL's
we use complex JCL-Procs with executing other Procs and so on under OPC-Control.

So assume we have:

Group01 Institut01 Dep01
Group01 Institut01 Dep02

Group09 Institut15 Dep22

We have specific Procs and Programms for them.

STEP010 EXEC P441G&UGRP ...&UGRP is transformed to the Groupnumber
by runtime.

// INR=&UINS. ...is Parm for the above Procedure / Institut-Number

//BEST.KARTE DD * ...is allways the SYSIN

S673 &UKNR. ...is a sysin-statement for the programm called by the
ececuted procedure P441G&UGRP wich is using a Parm like INR=&UINS


So perhaps for Group09 Institut15 Dep22
it results in EXEC P441G009, INR=015

Proc P441G022 executes a Programm. This is getting Sysin:
S000 6
S673 022

Hope i could satisfy your Question, Regards, UmeySan
Back to top
View user's profile Send private message
mkssampathkumar
Warnings : 1

New User


Joined: 31 Aug 2006
Posts: 57
Location: chennai

PostPosted: Mon Sep 18, 2006 9:24 am    Post subject:
Reply with quote

hi umey
u mentioned like
"here u passing some values to ur user defined procedures.. "
can we pass instream data in procedur??
i asked this question in last post itself..


can u send the code which u already checked ?.it will help me to understand little more..


Thanks..
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. Need help how to pass the ESP variabl... Venkichaitu JCL & VSAM 12 Thu Nov 02, 2017 3:53 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Regarding time parameter shanthi gude JCL & VSAM 7 Mon Sep 04, 2017 2:31 pm
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm

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