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

Parm sending the wrong value.


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

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Wed Jan 30, 2008 6:11 pm
Reply with quote

Hello Everyone,

I am passing a string of 7 chars using PARM in my JCL to my cobol pgm. I have declared the varible in Linkage section. However I am getting my output not as expected. There are two spaces in my output which is ruining the output. I have attached the codes. Please take a look and suggest.

Thanks,
Anjani.[img][/img]
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 30, 2008 6:16 pm
Reply with quote

Did You read the docs carefully ???
the length should come before the string like this ...
Code:
01  JCL-PARM.                                           
    03  PARM-LEN                PIC S9(04) COMP.   
    03  PARM-TEXT               PIC X(100).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 30, 2008 6:18 pm
Reply with quote

as usual I hit enter too quickly..

why blame others?

jcl as far as I can remember never made mistakes in passing parms

programmers usually made mistakes in retrieving them
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jan 30, 2008 6:19 pm
Reply with quote

Move LS-VAR-LENGTH before LS-VAR-TEXT.

Validate LS-VAR-LENGTH and use it as the reference modification length when addressing LS-VAR-TEXT.

FWIW, define LS-VAR-TEXT as PIC X(100), which is the maximum length for a pass parm from JCL and always use LS-VAR-LENGTH as the reference modification length.

If you address LS-VAR-TEXT without using the reference modification length, you run the risk of raising a S0C4 Protection Exception.

HTH....

Regards,

Bill
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Wed Jan 30, 2008 6:37 pm
Reply with quote

Thanks Enrico & Bill,

I have fixed the prob and its working fine now....Just wanted to confirm:

The parm can pass a length of 100 chars and the first 2 of the data that reach the application pgm contains the length of the char which has been passed. Am I correct?

Thanks,
Anjani.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 30, 2008 6:39 pm
Reply with quote

Quote:
Am I correct?

Yesss !
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Wed Jan 30, 2008 7:18 pm
Reply with quote

Thank you so much Enrico. Have a good day icon_razz.gif







Thanks,
Anjani.
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 JCL EXEC PARM data in C Java & MQSeries 2
No new posts Need to specify PARM='POSIX(ON) Java & MQSeries 4
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts Passing parm from JCL to Assembler, b... PL/I & Assembler 2
Search our Forums:

Back to Top