Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Clarification on interview questions
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
dilpreet

New User


Joined: 18 Mar 2008
Posts: 34
Location: INDIA

PostPosted: Sun Oct 25, 2009 10:24 pm    Post subject: Clarification on interview questions
Reply with quote

1) i have a main program p1 and 2 subprograms p1 and p2 .is it possible to link one program dynamically and othe statically and how

2) if i pass 5 values from jcl to cobol and have 6 accept statements then what will happen.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7912
Location: Bellevue, IA

PostPosted: Sun Oct 25, 2009 10:37 pm    Post subject:
Reply with quote

What were your answers?

And for question number 2, there's no relationship between passing values from JCL to COBOL and COBOL ACCEPT statements so the question does not even make sense.
Back to top
View user's profile Send private message
dilpreet

New User


Joined: 18 Mar 2008
Posts: 34
Location: INDIA

PostPosted: Sun Oct 25, 2009 10:40 pm    Post subject:
Reply with quote

these Q? WERE RAISED ON SOME OTHER PORTAL.

REGARDING SECOND Q

IF WE PASS 5 CHARACTER VALUES THRU SYSIN DD *
AND HAVE 6 ACCEPT STATEMENTS IN THE COBOL PROGRAM.THEN WILL THE PROGRAM ABEND WITH ANY REASON CODE
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Oct 26, 2009 2:36 am    Post subject:
Reply with quote

Hello,

Quote:
WERE RAISED ON SOME OTHER PORTAL.
And what were the answers given. . .?

It is not proper to post things "across forums". . .

Oh, TURN OFF YOUR CAPS.
Back to top
View user's profile Send private message
dilpreet

New User


Joined: 18 Mar 2008
Posts: 34
Location: INDIA

PostPosted: Mon Oct 26, 2009 6:46 pm    Post subject:
Reply with quote

i came across these Q while gng thru some other mainframe sites . so wanted to knw there correct answers as they were nt provided there.being true

thought of this to be a correct place to find the best answers.

so please help me out knowing there correct answers

thanks
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Oct 26, 2009 9:41 pm    Post subject:
Reply with quote

Hello,

Personally, i believe there is at least some confusion with the questions. . . Which is why i asked about the answers given elsewhere.

Quote:
i have a main program p1 and 2 subprograms p1 and p2. is it possible to link one program dynamically and othe statically
P1 should not be both the main program and a sub-program?

Quote:
if i pass 5 values from jcl to cobol and have 6 accept statements
ACCEPT is not the way to pass values from JCL to the program. To pass values from JCL, the PARM is used?
Back to top
View user's profile Send private message
dilpreet

New User


Joined: 18 Mar 2008
Posts: 34
Location: INDIA

PostPosted: Mon Oct 26, 2009 10:27 pm    Post subject: @ dick
Reply with quote

sorry my mistake
in Q1

we have main program p1 and its calling 2 subprograms p2 and p3. can we link p2 statically and p3 dynamically in a same program.

in q2
if we pass values in jcl thru sysin dd * to cobol program
then we need accept statements in the cobol program.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 26, 2009 10:54 pm    Post subject:
Reply with quote

Quote:
then we need accept statements in the cobol program.

oh my, sigh.... That is not true.

treat it as a file:

code a select for 'sysin' (or better yet, use something like CARDIN, whatever) with file-status clause,
an fd
and use COBOL OPEN, READ, CLOSE to process the input.

by using the file-status clause you can tell if you are at end-of-file.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Oct 26, 2009 11:52 pm    Post subject:
Reply with quote

Hello,

Quote:
can we link p2 statically and p3 dynamically in a same program.
Well, one can be called statically while the other is called dynamically, but i believe this would not be desirable. . .


Quote:
if we pass values in jcl thru sysin dd * to cobol program
Once the data is associated with a DD statement, it is no longer a "value in jcl" - it is a file. . . Files should be opened, read, and closed rather than ACCEPTed (many organizations do not permit the use of ACCEPT in any code to be promoted to Production). If an ACCEPT is issued after the end of data has been reached, an abend results (the same as a read after end of file).
Back to top
View user's profile Send private message
dilpreet

New User


Joined: 18 Mar 2008
Posts: 34
Location: INDIA

PostPosted: Tue Oct 27, 2009 12:06 am    Post subject:
Reply with quote

THANKS DICK!!!
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Oct 27, 2009 3:21 am    Post subject:
Reply with quote

Hi,

Quote:
THANKS DICK!!!
would caps off make this a little dick icon_lol.gif



Gerry
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Wed Oct 28, 2009 12:40 pm    Post subject: Reply to: Clarification on interview questions
Reply with quote

Quote:
If an ACCEPT is issued after the end of data has been reached, an abend results (the same as a read after end of file).

It is true that the usage of ACCEPT is not recommended.
But the program will not face any abend if you try to ACCEPT after the end of data has been reached.
You will continue to read the last supplied data in SYSIN DD*
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7912
Location: Bellevue, IA

PostPosted: Wed Oct 28, 2009 5:18 pm    Post subject:
Reply with quote

Quote:
But the program will not face any abend if you try to ACCEPT after the end of data has been reached.
You will continue to read the last supplied data in SYSIN DD*
This is not accurate -- once you hit EOF, the receiving field is unchanged so it may look like you read the last supplied data but you're not. The COBOL Language Reference manual says (emphasis added by me)
Quote:
System input device

The length of a data transfer is the same as the length of the record on the input device, with a maximum of 32,760 bytes.

The system input device is read until the receiving area is filled or EOF is encountered. If the length of the receiving area is not an even multiple of the system input device record length, the final record will be truncated as required. If EOF is encountered after data has been moved and before the receiving area has been filled, the receiving area is padded with spaces of the appropriate representation for the receiving area. If EOF is encountered before any data has been moved to the receiving area, padding will not take place and the contents of the receiving area are unchanged. Each input record is concatenated with the previous input record.
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Wed Oct 28, 2009 5:56 pm    Post subject: Reply to: Clarification on interview questions
Reply with quote

Quote:
This is not accurate -- once you hit EOF, the receiving field is unchanged so it may look like you read the last supplied data but you're not.
I am in agreement to what you have referred to.
Quote:
dilpreet:
2) if i pass 5 values from jcl to cobol and have 6 accept statements then what will happen.

Quote:
Dick :
If an ACCEPT is issued after the end of data has been reached, an abend results (the same as a read after end of file).

My post was just to explain that in this particular instance it won't abend and you would continue to see the last value read from SYSIN DD* until and unless you don't initialize the variable.
Is it possible to face EOF in this case i.e. while using ACCEPT?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Wed Oct 28, 2009 8:11 pm    Post subject:
Reply with quote

Quote:
Is it possible to face EOF in this case i.e. while using ACCEPT?
If you have access to a mainframe, this is easy enough to find out via a test program. Let us know the results.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Oct 28, 2009 8:29 pm    Post subject: Reply to: Clarification on interview questions
Reply with quote

Quote:
Is it possible to face EOF in this case i.e. while using ACCEPT?


and what would you interrogate? where would you look for an EOF indicator?
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Wed Oct 28, 2009 8:46 pm    Post subject: Reply to: Clarification on interview questions
Reply with quote

Dbz
Quote:
and what would you interrogate? where would you look for an EOF indicator?

And that is what i am trying to tell that how do we intend to do that in case of an ACCEPT.

Terry
Code:
WORKING-STORAGE SECTION.
01 A PIC X(50) VALUE SPACES.
01 AC1      PIC 9(02) VALUE ZEROES.

PROCEDURE DIVISION.             
 0001-MAIN.                     
      PERFORM UNTIL AC1 > 6     
      ACCEPT A                 
      DISPLAY "VALUE FETCHED" A
      COMPUTE AC1 = AC1 + 1     
      END-PERFORM               

JOB
Code:

//SYSIN DD *                 
SDAKJFHDASLKGFDLGFHJDKAS     
2222                         
44444                       
66666                       
/*                           

Spool
Code:

VALUE FETCHEDSDAKJFHDASLKGFDLGFHJDKAS     
VALUE FETCHED2222                         
VALUE FETCHED44444                       
VALUE FETCHED66666                       
VALUE FETCHED66666                       
VALUE FETCHED66666                       
VALUE FETCHED66666                       


If you Initialize the variable before you do next ACCEPT

Code:
0001-MAIN.                     
      PERFORM UNTIL AC1 > 6     
      ACCEPT A                 
      DISPLAY "VALUE FETCHED" A
      MOVE SPACES TO A
      COMPUTE AC1 = AC1 + 1     
      END-PERFORM   


SPOOL
Code:

VALUE FETCHEDSDAKJFHDASLKGFDLGFHJDKAS   
VALUE FETCHED2222                       
VALUE FETCHED44444                     
VALUE FETCHED66666                     
VALUE FETCHED                           
VALUE FETCHED                           
VALUE FETCHED                                               


So, the program doesn't abend and therefore I asked that question when we were discussing about EOF and ACCEPT,till the time we are not treating it as a file.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Oct 28, 2009 8:53 pm    Post subject: Reply to: Clarification on interview questions
Reply with quote

how about:
Code:

0001-MAIN.                     
      Move high-values to A
      ACCEPT A                 
      PERFORM UNTIL A = high-values     
          DISPLAY "VALUE FETCHED: " A
          MOVE high-values TO A
          ACCEPT A                 
      END-PERFORM   
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Oct 28, 2009 9:00 pm    Post subject:
Reply with quote

Hello,

Quote:
But the program will not face any abend if you try to ACCEPT after the end of data has been reached.
Interesting - "once upon a time" this caused an S001-05 (get or read issued after end of file) - IIRC. . . It has been more than 30 years since anyone on any of the systems i've supported used an ACCEPT for data.

I guess the compiler folks decided to "dumb down" the process to prevent the abend. . . icon_confused.gif

Thanks for the clarification.
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Wed Oct 28, 2009 9:09 pm    Post subject: Reply to: Clarification on interview questions
Reply with quote

There are other ways to find out the end of valid data as well.The only point when i posted was to tell that the program will NOT ABEND and we donot set anything like AT END SET ACCEPT-EOF TO TRUE for ACCEPT.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INCLUDE condition questions van bui DFSORT/ICETOOL 1 Thu Jun 30, 2016 9:52 am
No new posts Need clarification of VSAM FCT and DF... pkmurali CICS 15 Sun Apr 10, 2016 1:06 am
No new posts SAS Programming - Basic Questions Techelm All Other Mainframe Topics 3 Fri Mar 18, 2016 10:53 pm
No new posts Where can i find Interview questions ... Elixir Mainframe Interview Questions 4 Sat Feb 20, 2016 12:38 am
This topic is locked: you cannot edit posts or make replies. Mainframe interview on 10th Oct 2015 ... kotesh Mainframe Jobs 0 Thu Oct 08, 2015 5:21 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us