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
 

 

Is it possible to accept variables through JCL for Cobol

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

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Sun Jul 23, 2006 2:34 pm    Post subject: Is it possible to accept variables through JCL for Cobol
Reply with quote

Hi,
Is it possible to accept variables through JCL for Cobol program.
But the number of variables to my program changes each time ?
If it can be done can anyone let me know how to set my JCL and Cobol program.

Thanks,
Diwakar

Nobody is perfect. I am Nobody.
Back to top
View user's profile Send private message

kamran

New User


Joined: 01 May 2005
Posts: 55

PostPosted: Sun Jul 23, 2006 3:08 pm    Post subject: Re: Variables for Cobol thru JCL
Reply with quote

Hi,
If the data being passed to cobol would not be greater than 100 byte you can pass them through PARM parameter of EXEC statement and you can retreive it via defining a record matching the input parm and make accesible it upon entry to cobol program via using:
Procedure Division using Input-parm.
which Input-parm is the record which you must define it in the linkage section.
But if the size of the input parms exceed 100 byte in length you can read them from an input file or using ACCEPT instruction which by default will read a record from a file allocated to the SYSIN card in your jcl.



diwa_thilak wrote:
Hi,
Is it possible to accept variables through JCL for Cobol program.
But the number of variables to my program changes each time ?
If it can be done can anyone let me know how to set my JCL and Cobol program.

Thanks,
Diwakar

Nobody is perfect. I am Nobody.
Back to top
View user's profile Send private message
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Sun Jul 23, 2006 3:23 pm    Post subject:
Reply with quote

Hi Kamran,

Thank you, But we can do that using DD Statement also.

Can you give me some example how we can do that using DD statement

Thanks.

Diwakar


Nobody is perfect. I am Nobody.
Back to top
View user's profile Send private message
kamran

New User


Joined: 01 May 2005
Posts: 55

PostPosted: Mon Jul 24, 2006 4:23 pm    Post subject:
Reply with quote

Hi
could you please explain us your need through an example to help us decide which way is better for you to code your program!.
anyhow for getting through dd statement you can code
//SYSIN dd *
any line of data
/*
and in your source code:
ACCEPT anyname FROM SYSIN.
where anyname is a record defined in the WORKING STORAGE SECTION.
you can change the name of input dd card from SYSIN to any other name and you must follow the ruls for reading files in your jcl so you need to code more statements to satisfy your need.
for more information about ACCEPT statement chec the following:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR30/6.2.1?SHELF=IGY3SH30&DT=20050714120224
Back to top
View user's profile Send private message
diwa_thilak

Active User


Joined: 13 Jul 2006
Posts: 205
Location: At my desk

PostPosted: Tue Jul 25, 2006 6:10 pm    Post subject: Re: Is it possible to accept variables through JCL for Cobol
Reply with quote

Hi Kamran,

This is my requirement.

I have to check whether the stores are there in PS. The number of stores will differ each day.

i have to send two dates for the search with the store numbers.

My cobol program will accept the date and the stores and it will generate a report.

Any different views you have .

Thanks,
Diwakar.
Back to top
View user's profile Send private message
kamran

New User


Joined: 01 May 2005
Posts: 55

PostPosted: Wed Jul 26, 2006 6:21 pm    Post subject: Re: Is it possible to accept variables through JCL for Cobol
Reply with quote

Hi Diwakar,
So you should get the date from exec parm as I dicribed
above If the search dates are the same for all stors or
the dates should be included in each stors record.
anyhow your program logic should do a loop in reading an
input file whose each record of it have information about
a stor producing the report and after processing it the program
should read next record until the end of file condition occurs
by this logic you can at first check if there is any stor
in your input PS and next process any number of stors which
is included in the input PS.Note that for performance let the
system to determine the best block size of the input PS when
you create the input PS.
So All you need for doing this is to code:
in FILE-CONTROL:
SELECT STOR-FILE ASSIGN STORS FILE STATUS FSTAT.
in FILE-SECTION:
FD STOR-FILE
RECORD CONTAINS ?? CHARACTERS
BLOCK CONTAINS 0 RECORD.
01 FILLER PIC X(??)
?? is the lenght of following STOR-REC.
in WORKING-STORAGE SECTION:
01 FSTAT PIC 9(02).
01 STOR-REC.
05 DATE-FROM PIC 9(08).
05 DATE-TO PIC 9(08).
05 STOR-NUMBER PIC 9(??).
05 STOR-NAME PIC 9(??).
change the ?? above to appropriate number matching your stor name and stor number length.I suggest here each stor have a number and name which you need them for producing the report.
in PROCEDURE DEVISION:
OPEN STOR-FILE.
IF FSTAT NOT EQUAL ZERO THEN GO ENDPROG.
READ STOR-FILE INTO STOR-REC AT END
code somthing here to handle end of file processing
GO ENDPROG.
IF FSTAT NOT EQUAL ZERO THEN
call your error routine here.
call procedureto produce report for the input stor here.
arrange with PERFORM COBOL instruction so that read each record and report routine be in a loop which each time firat controls end of file condition.
Back to top
View user's profile Send private message
varun.miglani

New User


Joined: 25 Jun 2007
Posts: 2
Location: Gurgaon

PostPosted: Fri Jul 13, 2007 3:50 pm    Post subject: Re: Is it possible to accept variables through JCL for Cobol
Reply with quote

its very easy to give it through JCL
By just form the statement
//DD sysin *
give nay of the valut=ue
u can also use Accept statement to input in cobol progrtam
/*
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. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


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