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
 

 

Quetions in passing data through PARM

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Quetions in passing data through PARM
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    Post subject: Re: Quetions in passing data through PARM
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: 755
Location: Germany

PostPosted: Tue Nov 07, 2006 9:16 pm    Post subject:
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    Post subject: Re: Quetions in passing data through PARM
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: 755
Location: Germany

PostPosted: Wed Nov 08, 2006 1:59 pm    Post subject:
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    Post subject: Re: Quetions in passing data through PARM
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


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