MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing paramters to a COBOL program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Vish
Beginner


Joined: 17 Sep 2003
Posts: 21
Topics: 9
Location: Mumbai India

PostPosted: Tue Dec 23, 2003 6:22 am    Post subject: Passing paramters to a COBOL program Reply with quote

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
View user's profile Send private message
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Tue Dec 23, 2003 6:32 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Dec 23, 2003 6:42 am    Post subject: Reply with quote

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

Code:

  ACCEPT WS-PARM-REC
 


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
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Dec 23, 2003 6:46 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Tue Dec 23, 2003 7:00 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
Vish
Beginner


Joined: 17 Sep 2003
Posts: 21
Topics: 9
Location: Mumbai India

PostPosted: Tue Dec 23, 2003 7:01 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Dec 23, 2003 7:05 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Dec 23, 2003 7:10 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Tue Dec 23, 2003 7:22 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Dec 23, 2003 7:53 am    Post subject: Reply with quote

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
Code:

ACCEPT WS-PARM-REC


Does the checker complain now?

Thanks,

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Tue Dec 23, 2003 9:59 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group