View previous topic :: View next topic
|
Author |
Message |
Bindunat
New User
Joined: 10 Jun 2005 Posts: 5
|
|
|
|
When i pass a parameter from JCL to a cobol program and try to print the recieved value in cobol, it displays two junk characters preceding the actual parameter. if the size mentioned was just right, then the last two bytes from the parm gets truncated. what is the reason for the junk characters? and how can it be avoided while passing the value from JCL itself?
Somebody please help me with this...
thanks in advance. |
|
Back to top |
|
|
j_prameela2000
New User
Joined: 01 Jun 2005 Posts: 28 Location: Chennai
|
|
|
|
Hi Bindunat,
The first two junk characters represents length of the actual data passed.
you can not avoid that. if you want to receive length you should declare s9(4) comp in linkage section where u delcare parm variables as the first varible where the length will be stored. If i am wrong, please correct me. |
|
Back to top |
|
|
j_prameela2000
New User
Joined: 01 Jun 2005 Posts: 28 Location: Chennai
|
|
|
|
Hi Bindunat,
When u declare length field in linkage section along with parm variables, then when u receive the parameters passed through parm will get displayed without any junk characters. If iam wrong correct me. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Bindunat, could you please post an example of your program and of the calling JCL. |
|
Back to top |
|
|
Girishm
New User
Joined: 09 Mar 2005 Posts: 35 Location: Mysore
|
|
|
|
Hi bindu,
Let my detail U with an example:
Cobol code:
LINKAGE SECTION.
01 PARM-IN.
05 PARM-LENGTH PIC S9(4) COMP.
05 PARM-CENTURY PIC 99.
05 PARM-YEAR PIC 99.
05 PARM-PERIOD PIC 99.
and you are passing the parameter as PARM=200505 from the JCL
In the cobol program if you r trying to print PARM-IN, then as u said it will print junk chars before the actual data. But if you print PARM-CENTURY then it will display exact value that u have passed i.e, 20.
there is no way the parm gets truncated if you are passing correctly.
for the above code if ur parm is PARM=20050504, then obviously 04 get truncated, b'coz there is no declaration to receive that value in Linkage.
Hope this helps U. if not please brief with the code.
_________
GM |
|
Back to top |
|
|
Bindunat
New User
Joined: 10 Jun 2005 Posts: 5
|
|
|
|
Problem was I did'nt declare the variable for length in the linkage section for recieving the parm. So i got junk data. Thanks to all for the help |
|
Back to top |
|
|
|