View previous topic :: View next topic
|
Author |
Message |
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
Hi Dick,
How we have to specify the load module? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
Hi Dick,
Sorry for the third mail.Could you please tell me how to link it with easytrieve module. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
lcmontanez
New User
Joined: 19 Jun 2007 Posts: 50 Location: Chicago
|
|
|
|
FYI, Make sure the steplib has the location of the compiled cobol load module |
|
Back to top |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
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 |
|
|
lcmontanez
New User
Joined: 19 Jun 2007 Posts: 50 Location: Chicago
|
|
|
|
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 |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
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 |
|
|
lcmontanez
New User
Joined: 19 Jun 2007 Posts: 50 Location: Chicago
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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. . .
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 |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
shall I have to specify the link edited load module in my JCl? |
|
Back to top |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Any progress?
Change in symptoms? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Did you get the tiny sample ezt program to call the equally small cobol module successfully? |
|
Back to top |
|
|
rickyc.mathew
New User
Joined: 06 Mar 2008 Posts: 30 Location: kottayam
|
|
|
|
hi Dick,
I tried in different ways with little success.Could you help me?
Thanks,
Ricky |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I tried in different ways with little success.Could you help me?
|
Maybe - we can surely hope. . .
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 |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Ricky,
Using BBCode will make your code more readable and we can see the exact positions of everything. |
|
Back to top |
|
|
|