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!

Passing data from CL to Cobol 1

Status
Not open for further replies.

sHiZniT

MIS
Mar 28, 2001
2
US
Hi! i need help passing data from a cl program to a cobol program. i am a beginner programmer with some experience with these two languages. the environment is as/400. if anyone can help i'd be much appreciative.

thank you
han
 
Looks like this one has been forgotten but here is a quick hint.

Whenever you write a statement in CL, you can hit the F4 button and the screen will prompt you for the correct parameters associated with the command you have just written.

I haven't worked on As/400 for a while, and don't currently have access to one but here goes (the syntax maybe poor)..

CALL PGM((pgm-name) PARMS(PARM1 PARM2 PARM3))

where PARM1 etc have already been defined at the top of you CL program so you already know their type.

You can pass these parameters to the cobol linkage section, where they must map exactly onto each other i.e you COBOL linkage section would look something like this

LINKAGE SECTION
01 LINKAGE.
03 FIELD1 PIC..(whatever PARM1 is)
03 FIELD2 ditto
03 FIELD3 ditto

PROCEDURE DIVISION USING FIELD1 FIELD2 FIELD3.

etc

note.. you can pass strings from CL like this "string value" but I wouldn't recommend this with numeric fields. Numeric values for parameters can be a pain in the arse for CL if you don't know what you are doing, avoid this problem (until you are more proficient) by passing all numerics as alphanumeric fields rather than numeric ones.

also note... you do not need to pass a length parameter in COBOL/400 as you do on mainframe cobol.

let me know if this has been helpful as I would like to know how good my memory is.

further note.. parm passing from CL is the same regardless of the whether the language the receiving program is written in is cobol or rpg.

pipk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top