View previous topic :: View next topic |
Author |
Message |
Vish Beginner
Joined: 17 Sep 2003 Posts: 21 Topics: 9 Location: Mumbai India
|
Posted: Tue Dec 23, 2003 6:22 am Post subject: Passing paramters to a COBOL program |
|
|
Hi friends,
I have parameters to pass to a program which exceeds 100 characters.I will not be able to code the Parameters as PARM as I believe it accepts max of 100 characters.
I guess we can do it through SYSIN. But I dont know exactly how to code the COBOL statements if I use the multiple lines in SYSIN.Can somebody help me regarding this. _________________ Vish |
|
Back to top |
|
|
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Tue Dec 23, 2003 6:32 am Post subject: |
|
|
MOVE SPACES TO WS-INP
PERFORM UNTIL WS-INP = HIGH-VALUES
MOVE HIGH VALUES TO WS-INP
ACCEPT WS-INP FROM SYSIN
END-PERFORM
ALSO CODE SELECT STATEMENT FOR SYSIN |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Dec 23, 2003 6:42 am Post subject: |
|
|
Vish
very simple and easiest of all tasks. Define a working storage variable for the sysin record and use the ACCEPT verb to read the data.
Code: |
01 WS-PARM-REC.
05 WS-PARM1 PIC X(03).
05 WS-PARM2 PIC X(10).
....
|
Now in the procedure division
In your JCl code the sysin as follows
Code: |
//SYSIN DD *
PARM Record One
/*
|
Hope this helps...
cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Dec 23, 2003 6:46 am Post subject: |
|
|
sreejith,
Why do you need a select statement for the sysin? Personally I would prefer checking for spaces instead of high-values after the accept.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Tue Dec 23, 2003 7:00 am Post subject: |
|
|
kolusu,
We have a "standard checker" along with our compile. It complains if I don't have a select statement, FD and a working storage copybook of the file description.
sreejith |
|
Back to top |
|
|
Vish Beginner
Joined: 17 Sep 2003 Posts: 21 Topics: 9 Location: Mumbai India
|
Posted: Tue Dec 23, 2003 7:01 am Post subject: |
|
|
Thanks Sreejit. Thanks Kolusu for your responses.
Kolusu,
I am little confused with using more than 1 records in SYSIN. Can you please give me the example for that. _________________ Vish |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Dec 23, 2003 7:05 am Post subject: |
|
|
Sreejith,
wow!! Do you mean to say that the "standard checker" scans the JCL for the program being execueted and throws an error if it does not find matching select statement, FD and working storage copybook for all the DD names in the JCl?
or does the checker scan the program for "ACCEPT" statements and then flags them as errors? What will happen when you are accepting DATE & TIME from the system?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Dec 23, 2003 7:10 am Post subject: |
|
|
vish,
Use the logic posted by sreejith to read multiple records
Code: |
ACCEPT WS-PARM-REC
PERFORM UNTIL WS-PARM-REC = SPACES
do all your parm processing here
MOVE SPACES TO WS-PARM-REC
ACCEPT WS-PARM-REC
END-PERFORM
|
Hope this helps...
cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Tue Dec 23, 2003 7:22 am Post subject: |
|
|
I think it scans the program. some times it is annoying. for ex. every FD should have a copybook in FD and WS, use BINARY instead of comp etc.
I guess it looks for SYSIN in procedure div. As a matter of fact we can't do accept date or time that will throw an error. we need to call a subroutine to do that. I think the reason behind this is to change the 'System date and time' easily
sreejith |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Dec 23, 2003 7:53 am Post subject: |
|
|
Sreejith,
Can you check this for me please? I want to see if we can fool the checker. Accept statements do not require an exclusive FROM SYSIN. The default for accept verb is sysin.
So just run the following code
Does the checker complain now?
Thanks,
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Sreejith Intermediate
Joined: 02 Dec 2002 Posts: 155 Topics: 25 Location: N.Ireland
|
Posted: Tue Dec 23, 2003 9:59 am Post subject: |
|
|
kolusu,
Yes. You cracked it. It is not giving any error. but to my surprise there is an error message from optimizer saying no file operation found for SYS-IN-FILE. of course now I don't need it.
Thanks
Sreejith |
|
Back to top |
|
|
|
|