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

Is it possible to accept variables through JCL for Cobol


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top