Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the parm length field if parm is not coded?

Status
Not open for further replies.

nxm150

Programmer
May 22, 2002
78
US
Let's say I have coded a linkage section in my program but do not specify a PARM in JCL. What value would LINKAGE-RECL contain?

01 LINKAGE.
05 LINKAGE-RECL PIC S9(2) USAGE COMP.
05 LINKAGE-FIELD PIC X(1).
 
Hi,

I prefer this definition:

000015 01 PARM.
000016 03 PARM-LENGTH PIC S9(4) COMP-5.
000017 03 PARM-DATA.
000018 05 PARM-TEKEN OCCURS 0 TO 120 DEPENDING ON
000019 PARM-LENGTH PIC X.

PARM-LENGTH will be zero if there is no parm!

You can use PARM-DATA just like any other field.

Regards,

Crox

 
I agree that
Pic S9(04)
is better than
Pic S9(02)

but the use of COMP-5 instead of COMP depends on what release of the compiler is being used. COMP-5 support on IBM mainframes, is "relatively" new.
 
We used to define

S9(4) COMP-4.

But.... the processing depends on your compiler directives. To avoid any problem, use COMP-5.
 
When you say "compiler directives" instead of "compiler options" - my guess is that you are using Micro Focus and *not* an IBM compiler. COMP-5 is available with all releases of Micro Focus (that I know of) - but is NOT available with all releases of IBM.

Therefore, the "solution" depends on the compiler - as well as directives/options.
 
"PARM" and "JCL" are IBM mainframe terms, so it must be a version of IBM mainframe COBOL.

When I worked on IBM mainframes, I used S9(4) COMP as the manual says the length field is half-word (2 bytes) binary.

By the way, the COBOL environment strips out the COBOL run-time options in the front of the PARM and passes the resulting length and string to the application. I don't remember what the delimiter it looks for, but I think it is ")". Whatever it is, if you use the delimiter in the application's parameter data, you must precede the application's parameter string with COBOL's delimiter. This is documented in the COBOL manual, but is is rather obscure.
 
The funny part of this is that the discussion here is also about something which is not difficult to find out, just by coding it and running it.

btw, I use IBM mainframe 2.2 and CA-REALIA COBOL compilers.

Sample program:
Code:
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. PARMCHK.
000003 ENVIRONMENT DIVISION.
000004 CONFIGURATION SECTION.
000005 SOURCE-COMPUTER. IBM-PC.
000006 OBJECT-COMPUTER. IBM-PC.
000007 SPECIAL-NAMES.
000008     DECIMAL-POINT IS COMMA.
000009 INPUT-OUTPUT SECTION.
000010 FILE-CONTROL.
000011 DATA DIVISION.
000012 FILE SECTION.
000013 WORKING-STORAGE SECTION.
000014 LINKAGE SECTION.
000015 01  PARM.
000016     03  PARM-LENGTH                PIC S9(4) COMP-5.
000017     03  PARM-DATA.
000018         05  PARM-TEKEN OCCURS 0 TO 120 DEPENDING ON
000019             PARM-LENGTH            PIC X.
000020
000021 PROCEDURE DIVISION USING PARM.
000022 MAIN SECTION.
000023     DISPLAY QUOTE PARM-DATA QUOTE.
000024     GOBACK.

WYSIWYG....
 
Yes, I did realize that I could have coded this situation really easy but was opting for the easy way out and posting it. My team set up a proc to execute someone else's program. He had an edit in his program for the linkage length being greater than 0 but the proc did not have a PARM parameter.
 
nxm150:
That's exactly how we handle it. If the parm length is zero, the assumption is that the parm was not coded.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top