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

Calling a cobol from easytrieve


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Wed Jun 25, 2008 9:00 pm
Reply with quote

Can any tell me how to call a cobol program from an easytrieve.

How to compile the cobol program?

How to specify the load module in the program?

If possible can anyone cut and paste the required parts of the modules.
thanks,
ricky
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jun 25, 2008 10:01 pm
Reply with quote

Hello,

Calling a cobol module from easytrieve is very similar to calling a cobol program from another cobol program.

All you need is this
Code:
CALL COBPGM USING ('a literal', AFLD)
in the easytrieve code. This example shows passing both a literal and a data field to the called module.

You can also specify RETURNS to recieve the return code from the called module.
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Thu Jun 26, 2008 10:14 am
Reply with quote

Hi Dick,

How we have to specify the load module?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jun 26, 2008 10:51 am
Reply with quote

Hello,

In my example COBPGM is the name of the cobol load module.

Compiling the called module is the same as compiling it for being called by another cobol program. You might create a simple cobol program to call your module and then call it via easytrieve making sure both perform the same way.
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Thu Jun 26, 2008 1:10 pm
Reply with quote

Hi Dick,
Sorry for the third mail.Could you please tell me how to link it with easytrieve module.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 27, 2008 3:37 am
Reply with quote

Hello,

You should not need to link it with the eztrieve code.

Try the test i mentioned earlier using a dynamic call in the test cobol calling program (rather than a static call). I do not believe there should be any linkedit issues.

If i can, i'll try something later tonight or tomorrow.

In the meantime, i'd suggest you give it a try and if anything unexpected happens, post back here and we'll figure it out.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 30, 2008 2:28 am
Reply with quote

Hello,

Have you had success yet?

Sorry that i've not gotten back sooner, but when i tried to put this on a system, a few surprises happened.

I'm trying to determine if there are release level issues/differences. Which release of Easytrieve are you using?

I've also moved the topic to CA Products from the COBOL part of the forum so maybe others who are currently doing this will post how this works on their system.
Back to top
View user's profile Send private message
lcmontanez

New User


Joined: 19 Jun 2007
Posts: 50
Location: Chicago

PostPosted: Mon Jun 30, 2008 10:06 pm
Reply with quote

FYI, Make sure the steplib has the location of the compiled cobol load module
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Tue Jul 01, 2008 3:24 pm
Reply with quote

Hi All,
I tried whatever mentioned here and my program is giving a return code of 0. But my easytrieve module is not calling the cobol module.Could any one having the sample code past it here?

Thanks,
Ricky
Back to top
View user's profile Send private message
lcmontanez

New User


Joined: 19 Jun 2007
Posts: 50
Location: Chicago

PostPosted: Tue Jul 01, 2008 7:41 pm
Reply with quote

Try adding this to the first statment in program

PARM DEBUG (STATE) ENVIRONMENT(COBOL) LIST (FILE PARM)

Did you get to the called programs? Post up your code.

Here is a quick sample:

CALL PENDACCS USING (IO-CONTROL-AREA +
PEND-IO-RECORD +
PEND-IO-REAL-KEY +
AK-RECORD)
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Wed Jul 02, 2008 3:56 pm
Reply with quote

LIST ON
* CHANGE LOG
************************************************************************
PARM DEBUG (STATE) ENVIRONMENT(COBOL) LIST (FILE PARM)
**********
FILE INPUTFIL
INPUT-DATE-IN 1 8 N
VALID-RES 10 1 N
*******
DEFINE WS-INPUT-DATE-IN W 08 N 0
DEFINE WS-VALID-RES W 01 N 0

***********************************************************************
JOB INPUT (INPUTFIL KEY INPUT-DATE-IN)
* START SIGNON FINISH DISPTOT
***********************************************************************
IF EOF INPUTFIL
STOP

*******
MOVE INPUT-DATE-IN TO WS-INPUT-DATE-IN
* MOVE VALID-RES TO WS-VALID-RES
CALL PROGRAM1 USING ( WS-INPUT-DATE-IN) RETURNS WS-VALID-RES
DISPLAY 'WS-VALID-RES= ' WS-VALID-RES

Cobol Module:
IDENTIFICATION DIVISION.
PROGRAM-ID. VALIDATE IS INITIAL.
AUTHOR. MICHAEL COUGHLAN.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 MONTHDAYTABLE.
02 TABLEVALUES PIC X(24)
VALUE '312831303130313130313031'.
02 FILLER REDEFINES TABLEVALUES.
03 DAYSINMONTH
OCCURS 12 TIMES PIC 99.
01 CURRUPTDATE PIC 9(8).
01 LEAPQUOT PIC 9(4).
01 LEAPREMAIN PIC 9(4).
01 FILLER PIC 9 VALUE ZERO.
88 LEAPYEAR VALUE 1.
LINKAGE SECTION.
01 INPUTDATELA.
02 DAYLA PIC 99.
02 MONTHLA PIC 99.
88 MONTHINVALID VALUE 13 THRU 99.
88 MONTHISFEBRUARY VALUE 2.
02 YEARLA PIC 9(4).
01 VALIDATIONRESULTLB PIC 9.
88 DATEISVALID VALUE 0.
88 DATENOTNUMERIC VALUE 1.
88 YEARCONTAINSZEROS VALUE 2.
88 MONTHCONTAINSZEROS VALUE 3.
88 DAYCONTAINSZEROS VALUE 4.
88 MONTHGREATERTHAN12 VALUE 5.
88 DAYTOOGREATFORMONTH VALUE 6.
PROCEDURE DIVISION USING INPUTDATELA, VALIDATIONRESULTLB.
BEGIN.
EVALUATE TRUE
WHEN INPUTDATELA NOT NUMERIC SET DATENOTNUMERIC TO TRUE
WHEN YEARLA EQUAL TO ZEROS SET YEARCONTAINSZEROS TO TRUE
WHEN MONTHLA EQUAL TO ZEROS SET MONTHCONTAINSZEROS TO TRUE
WHEN DAYLA EQUAL TO ZEROS SET DAYCONTAINSZEROS TO TRUE
WHEN MONTHINVALID SET MONTHGREATERTHAN12 TO TRUE
WHEN OTHER PERFORM CHECKFORVALIDDAY
END-EVALUATE
EXIT PROGRAM.

CHECKFORVALIDDAY.
DIVIDE YEARLA BY 400 GIVING LEAPQUOT REMAINDER LEAPREMAIN.
IF LEAPREMAIN = 0
SET LEAPYEAR TO TRUE
ELSE
DIVIDE YEARLA BY 100 GIVING LEAPQUOT REMAINDER LEAPREMAIN
IF LEAPREMAIN NOT = 0
DIVIDE YEARLA BY 4 GIVING LEAPQUOT REMAINDER LEAPREMAIN
IF LEAPREMAIN = 0
SET LEAPYEAR TO TRUE
END-IF
END-IF
END-IF
IF LEAPYEAR AND MONTHISFEBRUARY
MOVE 29 TO DAYSINMONTH(2)
END-IF
IF DAYLA GREATER THAN DAYSINMONTH(MONTHLA)
SET DAYTOOGREATFORMONTH TO TRUE
ELSE
SET DATEISVALID TO TRUE
END-IF.

Please find my code.But now my job is abending with SOC4
Back to top
View user's profile Send private message
lcmontanez

New User


Joined: 19 Jun 2007
Posts: 50
Location: Chicago

PostPosted: Wed Jul 02, 2008 7:12 pm
Reply with quote

Are you using Ent. Cobol? Did you add the SCEE lib to your steplib?
Where did the Soc4 occur....Cobol program or EZt? Post the line number and error messages.

Please try to provide as much detail as possible so that we can help.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 03, 2008 1:47 am
Reply with quote

Hello,

Sorry for the delay. Turns out the system w/ ezt is running a very old ezt (6.3) and some of the code i used would not run on the old release. . . icon_confused.gif

This code does work in the old release:
Code:
PARM DEBUG (STATE) ENVIRONMENT (COBOL) LIST (FILE PARM)       
DEFINE PKDFLD W 7 P 2 VALUE 0                                 
DEFINE DSCHCLD1 W 8 A  VALUE 'DSCHCLD1'                       
DEFINE SOME-VALUE W 12 A  VALUE 'SOME VALUE'                 
JOB INPUT NULL                                               
CALL DSCHCLD1 USING (SOME-VALUE)                             
STOP                                                         


This is the displayed output:
Code:
HELLO WORLD.
SOME VALUE   


This is the called cobol module (note the parm is not the same length of the ezt definition - intentionally):
Code:
       DATA DIVISION.                                                 
       WORKING-STORAGE SECTION.                                       
       77  WKS-MESSAGE         PIC X(23) VALUE                       
                                   'WORKING-STORAGE SECTION'.         
       77  HELLO-WORLD         PIC X(15) VALUE 'HELLO WORLD.'.       
      *                                                               
       LINKAGE SECTION.                                               
       01  PARM-AREA.                                                 
           05 SOME-PARM        PIC X(10).                             
      *                                                               
       PROCEDURE DIVISION USING PARM-AREA.                           
                                                                     
           DISPLAY HELLO-WORLD.                                       
           DISPLAY SOME-PARM.                                         
      *                                                               
       999-END.                                                       
           GOBACK.                                                   


You might try this simple test on your system and let us know what happens. . .
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Thu Jul 03, 2008 4:13 pm
Reply with quote

shall I have to specify the link edited load module in my JCl?
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Thu Jul 03, 2008 4:35 pm
Reply with quote

hi
I tried to execute the code but I am getting the following error
B059 PREMATURE END OF FILE

Please help.

thanks,
Ricky
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 03, 2008 8:51 pm
Reply with quote

Hello,

Quote:
shall I have to specify the link edited load module in my JCl?
No, you do need to link the cobol module into a loadlib that is named in your joblib/steplib or is link listed.

Did you compile the cobol program i posted? If not, do so.

Did you use exactly the ezt code posted? Again, if not, do so.

Once these are done, post your jcl, ezt code, and the output from the ezt executon.
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Fri Jul 04, 2008 8:26 am
Reply with quote

Pleaswev find the easytrieve and cobol module which I haveused.Also find the error message.
Cobol Module:
IDENTIFICATION DIVISION.
PROGRAM-ID. VALIDATE IS INITIAL.
AUTHOR. MICHAEL COUGHLAN.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WKS-MESSAGE PIC X(23) VALUE
'WORKING-STORAGE SECTION'.
77 HELLO-WORLD PIC X(15) VALUE 'HELLO WORLD.'.
PROCEDURE DIVISION USING PARM-AREA.

DISPLAY HELLO-WORLD.
DISPLAY SOME-PARM.

999-END. GOBACK.

LINKAGE SECTION.
01 PARM-AREA.
05 SOME-PARM PIC X(12).


Easytrieve Module:

//STEP01 EXEC PGM=EZTPA00
//STEPLIB DD DSN=APG.TEST.LOAD(COBOL2),DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSNAP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,1)
//EZTVFM DD UNIT=SYSDA,SPACE=(4096,(100,100))
//SYSIN DD *
LIST ON
PARM DEBUG (STATE) ENVIRONMENT (COBOL) LIST (FILE PARM)
DEFINE PKDFLD W 7 P 2 VALUE 0
DEFINE COBOL2 W 8 A VALUE 'COBOL2'
DEFINE SOME-VALUE W 12 A VALUE 'SOME VALUE'
JOB INPUT NULL
CALL COBOL2 USING (SOME-VALUE)
STOP

Error Message
*******B059 PREMATURE END OF FILE
*******A014 PREMATURE TERMINATION DUE TO PREVIOUS ERROR(S)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jul 04, 2008 8:55 am
Reply with quote

Hello,

Did you successfully call your "hello world" module from some other cobol program? If not, it would eliminate one more unknown to do so. Is the load module really named cobol2?

You posted the linkage secton at the bottom - any particular reason why?

Try removing the 1st easytrieve statement (list on). Also, please post the complete easytrieve output.
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Fri Jul 04, 2008 10:33 am
Reply with quote

hi Dick,

I tried to execute the module after making the changes as you suggested.Still I am facing the same error.I am not getting any output other than the error stements listed in the last post.

The linkage section is only mistake happened while pasting it to the forum.

Kindly help.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jul 04, 2008 12:54 pm
Reply with quote

Hello,

What happened when you tried to call your cobol subprogram from another cobol program rather than easytrieve?

You haven't posted the complete easytrieve output yet. . .
Quote:
I am not getting any output other than the error stements listed in the last post.
Maybe no more errors, but there is more output. . .

When some of us ask for things to be done, there are reasons. . .
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jul 08, 2008 10:19 pm
Reply with quote

Hello,

Any progress?

Change in symptoms?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 17, 2008 3:25 am
Reply with quote

Hello,

Did you get the tiny sample ezt program to call the equally small cobol module successfully?
Back to top
View user's profile Send private message
rickyc.mathew

New User


Joined: 06 Mar 2008
Posts: 30
Location: kottayam

PostPosted: Thu Jul 17, 2008 12:02 pm
Reply with quote

hi Dick,

I tried in different ways with little success.Could you help me?

Thanks,
Ricky
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 17, 2008 7:40 pm
Reply with quote

Hello,

Quote:
I tried in different ways with little success.Could you help me?
Maybe - we can surely hope. . . icon_smile.gif

Did you run the exact ezt and cobol code i posted (ezt is sometimes "picky")? If not do so. Once both have been compiled/run, please post the full output from the ezt run.

It may be that your system has a slightly different setup than the ezt system i currently have access to and this may cause the syntax to need to change as well.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Jul 17, 2008 7:54 pm
Reply with quote

Ricky,
Using BBCode will make your code more readable and we can see the exact positions of everything.
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 -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top