IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Quetions in passing data through PARM


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
herewego

New User


Joined: 20 Feb 2006
Posts: 14

PostPosted: Tue Nov 07, 2006 6:48 pm
Reply with quote

A) You are passing parm value ?ABCDE? to cobol programme through JCL. What will happen if you declare in linkage section 1) picx(5)

2)pic x(6)

3)pic x(4)


B) In cobol programme A you are calling Programe B using ws-va1,ws-va2,ws-va3.
1) what will happen if you call B using ws-va1,ws-va2 not using ws-va3.
2) what will happen in programme B

you have written procedure division using ws-va1,ws-va2 not using ws-va3
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Nov 07, 2006 8:15 pm
Reply with quote

Quote:

A) You are passing parm value ?ABCDE? to cobol programme through JCL. What will happen if you declare in linkage section 1) picx(5)

2)pic x(6)

3)pic x(4)


First, your definition in linkage needs to include a length as PIC S9(4) COMP.

i.e.
01 JCL-PARM.
05 PARM-LEN PIC S9(4) COMP.
05 PARM-STRING PIC X(??).

Second, the definition in LINKAGE section does not allocate storage; it only defines the storage that is passed to you. So in your example, regardless of how you have the storage defined, the storage will contain:

01 JCL-PARM.
05 PARM-LEN PIC S9(4) COMP VALUE 5.
05 PARM-STRING PIC X(??) VALUE ?ABCDE?.

Whenever you process the PARM, you need to interrogate the PARM-LEN to see how long the PARM-STING is. If the PARM-LEM = 0, no parm exists.

So, the PIC X(5) = ?ABCDE?
PIC X(6) = ?ABCDE.? The ?.? Is an undefined value, usually binary zeros
PIC X(4) = ?ABCD?

Dave
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Nov 07, 2006 9:16 pm
Reply with quote

Hi !

You always have to take care, that the structure in the Linkage corresponds to the receiving Parameters. Also take care of the LengthField, as DavidK told you before.

Regards, UmeySan
Back to top
View user's profile Send private message
herewego

New User


Joined: 20 Feb 2006
Posts: 14

PostPosted: Wed Nov 08, 2006 1:35 pm
Reply with quote

Dave,

Thanks for the reply.

I know that passing parameter is 'ABCDE' of lengh 5. So I don't understand why do we need to allocate PARM-LEN as S9(4) COMP.

Thanks,
Herewego
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Wed Nov 08, 2006 1:59 pm
Reply with quote

Hi !

You allways have to declare the PARM-LEN as S9(4) COMP, because this
field is used and insertet by system mechanisem automaticaly before the
real parameters.

regards, UmeySan
Back to top
View user's profile Send private message
vijay_bn79

New User


Joined: 20 Nov 2006
Posts: 48
Location: Hyderabad

PostPosted: Fri Nov 24, 2006 5:38 pm
Reply with quote

S9(4) Comp takes 2 bytes

in linkage section expects 2 bytes of length variable

so we should give S9(4) comp in linkage section
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Nov 25, 2006 5:17 am
Reply with quote

Hi HWG,

The len field is used to verify that the field is the len you expected. You would check that as you would the content if the field is to be alpha or numeric for example.

It's not a good idea to assume.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top