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
 

 

what will happen if we didnt decalre the length in Linkage

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
rakeshvp3
Currently Banned

New User


Joined: 19 May 2008
Posts: 2
Location: bangalore

PostPosted: Thu May 22, 2008 10:33 am    Post subject: what will happen if we didnt decalre the length in Linkage
Reply with quote

Hi

Please help me

1. what will happen if we didnt decalre the length variable in Linkage section for passing a value from a jcl to cobol through Parm parameter?

2.What is the advantage of declaring Length parameter as S9(4) COMP, why it is 9(4)?

3.In a calling program
W-S section.
01 A Pic X(4).
01 B PIC 9(4).
PD.
Call 'subpgm' using A,B

subpgm.
Linkage section.
01 A PIC 9(4).
01 B PIC 9(4).

Procedure division using A,B
what will happen in this case ?

3. Calling program

W-S section.
01 A Pic X(4).
01 B PIC 9(4).
01 C PIC 9(4).

PD
call 'subpgm' using A,B,C.

Subpgm
Linkage section.
01 A PIC 9(4).
01 B PIC 9(4).

Procedure division using A,B.

will it create any error message or not?

4.Calling program

W-S section.
01 A Pic X(4).
01 B PIC 9(4).


PD
call 'subpgm' using A,B.

Subpgm
Linkage section.
01 A PIC 9(4).
01 B PIC 9(4).
01 C PIC 9(4)
Procedure division using A,B,C.
will execute sucessfully?
Back to top
View user's profile Send private message

the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Thu May 22, 2008 10:54 am    Post subject:
Reply with quote


    If you dont declare the length variable in the linkage section, you may loose the first 2 bytes of data that you are passing through JCL as the program assumes the first 2 bytes to be the length of the data.

    In the first program you are receiving all the variables that are passed through the main program. so, no problem.

    In the second program you are not receiving all the variables that are passed through the main program. so, the data in C will be lost.

    In the last program you are passing only two variables and receiving three variables. the last variable will carry junk data.

    note : in the second and third case, you may get the errors S0C4 and S0C7 depending upon the use of the variable C.
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: Thu May 22, 2008 10:50 pm    Post subject:
Reply with quote

Hello,

Quote:
2.What is the advantage of declaring Length parameter as S9(4) COMP, why it is 9(4)?
The advantage is that is the way it works. It is 9(4) (and don't forget the COMP) because that is the way it is designed. This not something a programmer chooses - it is pre-defined.
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts File Manager with Variable Length File ahabib IBM Tools 10 Thu Mar 31, 2016 11:00 pm
No new posts How to copy data with delimters to fi... Venkata Ramayya DFSORT/ICETOOL 2 Wed Feb 24, 2016 10:03 pm


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