View previous topic :: View next topic
|
Author |
Message |
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
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 |
|
|
kamran
New User
Joined: 01 May 2005 Posts: 55
|
|
|
|
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 |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
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 |
|
|
kamran
New User
Joined: 01 May 2005 Posts: 55
|
|
|
|
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 |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
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 |
|
|
kamran
New User
Joined: 01 May 2005 Posts: 55
|
|
|
|
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 |
|
|
varun.miglani
New User
Joined: 25 Jun 2007 Posts: 2 Location: Gurgaon
|
|
|
|
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 |
|
|
|