Dynamically passing value to calling program in Easytrieve

Ask/Clarify the questions on EASYTRIEVE

Moderators: DikDude, Moderator Group

Post Reply
pawan.konduru
Member
Posts: 13
Joined: Mon Feb 17, 2014 11:35 am
Location: Hyderabad

Dynamically passing value to calling program in Easytrieve

Post by pawan.konduru » Mon Feb 17, 2014 11:42 am

hi,
Please help me if anyone know the code.

I have an easytrive which is calling a COBOL program using CALL statement.

I want to pass a value to the COBOL Program which is like PARM.

below is the code which i tried to pass, but it is not working

WS-PARM1 W 4 A VALUE 'XXX '

CALL PGM1 USING (WS-PARM1)

PGM1 is a COBOL program
Pawan K

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Feb 17, 2014 2:41 pm

You have to show how it is not working. What does the LINKAGE SECTION and PROCEDURE DIVISION USING look like in the COBOL program? What makes you say it is not working?

pawan.konduru
Member
Posts: 13
Joined: Mon Feb 17, 2014 11:35 am
Location: Hyderabad

Post by pawan.konduru » Tue Feb 18, 2014 11:02 am

Hi Collins,

here is the code in cobol program which i am using

working storage i defined a field
01 WS-PARM-REGION PIC X(04).
88 88-PARM-XXX VALUE 'XXX '.
88 88-PARM-YYYY VALUE 'YYYY'.

Linkage Section:
LINKAGE SECTION.
01 PARM.
05 LNGTH PIC S9(04) COMP.
05 PARM-REGION PIC X(04).


PROCEDURE DIVISION USING PARM.

MOVE PARM-REGION TO WS-PARM-REGION
-------
-------
-------
IF 88-PARM-XXX
PERFORM PROCESS-XXXX
ELSE
PERFORM PROCESS-YYYY
END-IF
-----
-----
STOP RUN.

---------------------------------------------
after complettion of the job with the easytrive code i gave, PROCESS-YYYY para is executing even i pass 'XXX '.
Pawan K

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Feb 19, 2014 12:30 am

Suggest you DISPLAY the fields in the LINKAGE section when the COBOL code is entered.

How is the ESYTRIEVE ENVIRONMENT set up?
Have a good one

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Wed Feb 19, 2014 4:00 am

Whoops. Seemed to have not posted an asnwer for this one...

You have defned your LINKAGE SECTION field incorrectly. That definition, which iincludes a length as the first part of a field, is fine from a program initiated by EXEC PGM=...,PARM="...." in your JCL, but Easytrieve CALLs use exactly the same conventions as COBOL CALLs, so there is no length in a field. You are accidentally ignoring the first two bytes of your field. Just define it as PIC X(4) without the COMP part at all.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Feb 20, 2014 1:59 am

Good catch, Bill - i missed that :roll:

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others