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 

Parameter passing to cobol program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Milind
Beginner


Joined: 29 Dec 2004
Posts: 26
Topics: 20

PostPosted: Tue Jul 12, 2005 12:21 am    Post subject: Parameter passing to cobol program Reply with quote

If there r 5 lines in SYSIN DD * and if use 6 accept stmts im my COBOL pgm whHat will Happend??

Will the program execute successfully or will it terminate?

Thanks and Regards,
Milind Deshmukh.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jul 12, 2005 5:39 am    Post subject: Reply with quote

Milind,

Milind,

You are slowly getting on my nerves. Most of your questions are already answered and can be found doing a simple search. You will not recieve any more answers unless you follow the rules of this forum.

Code:

1. Search before posting! Use meaningful topics (don't use the Forum name for the topic). Avoid putting "urgent" in your topics.

2. Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.

3. Provide feedback to members who try to help you.



Fyi.. Your program runs fine even when you have the accept verb 6 times when your sysin has only 5 lines. The last accept will have the value from line 5


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


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Wed Jul 13, 2005 4:01 am    Post subject: Reply with quote

Kolusu,

I tried with the following code. the last ACCEPT STATMENT IS READING SPACE. As you said the last accept will have the value from previous read it is not happening in my shop. is it compiler dependent? pls. clarify.
COBOL

IDENTIFICATION DIVISION.
PROGRAM-ID. CONDITIO.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC X(1).
01 B PIC X(1).
01 C PIC X(1).
01 D PIC X(1).
01 E PIC X(1).
PROCEDURE DIVISION.
MAIN.
ACCEPT A.
ACCEPT B.
ACCEPT C.
ACCEPT D.
ACCEPT E.
DISPLAY 'A : ' A.
DISPLAY 'B : ' B.
DISPLAY 'C : ' C.
DISPLAY 'D : ' D.
DISPLAY 'E : ' E.
STOP RUN.

JCL

//STEP1 EXEC PGM=CONDITIO
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
A
B
C
D
/*
//


nadh
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Wed Jul 13, 2005 5:45 am    Post subject: Reply with quote

Code this a total of 5 times and see what happens
Code:

 ACCEPT A FROM SYSIN.
 DISPLAY "A : " A.

_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Fri Jul 15, 2005 1:23 am    Post subject: Reply with quote

Hi

Even then it is same displaying space for last accept statment.

nadh.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jul 27, 2005 7:45 am    Post subject: Reply with quote

Quote:

Even then it is same displaying space for last accept statment.

nadh,

Are you sure ? try this code and tell me if you are displaying a space?

Code:

PROCEDURE DIVISION.
ACCEPT A.
DISPLAY 'FIRST ACCEPT VALUE OF A : ' A.
ACCEPT A.
DISPLAY 'SECOND ACCEPT VALUE OF A : ' A.
ACCEPT A.
DISPLAY 'THIRD ACCEPT VALUE OF A : ' A.
ACCEPT A.
DISPLAY 'FOURTH ACCEPT VALUE OF A : ' A.
ACCEPT A.
DISPLAY 'FIFTH ACCEPT VALUE OF A : ' A.
STOP RUN.


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming 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