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

Sub program which has to pass data back to the calling pgm


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Wed Apr 22, 2009 1:21 am
Reply with quote

I have a sub program which has to pass data back to the calling pgm. Is this data has to be in the LS of the sub pgm? and if so, how can I move data to LS from WS without having addressability problem? Mind you that it is using a dynamic call (not a link).
Thanks.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 1:48 am
Reply with quote

Felix61 wrote:
I have a sub program which has to pass data back to the calling pgm. Is this data has to be in the LS of the sub pgm?
Yes.
Quote:
and if so, how can I move data to LS from WS without having addressability problem? Mind you that it is using a dynamic call (not a link).
The procedure division header with a using on it will take care of the addressability, and a move is a move.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 22, 2009 1:55 am
Reply with quote

Also, if there are any "unexpected" errors encountered in the called sub-program, set the RETURN-CODE SPECIAL-REGISTER accordingly, which can then be interrogated by the Caller. When everything is OK, just set it to ZERO.

FWIW, the RETURN-CODE SPECIAL-REGISTER equates to setting an RC in R15 in Assembler.

Regards,
Back to top
View user's profile Send private message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Wed Apr 22, 2009 2:00 am
Reply with quote

Thanks for the fast reply... icon_biggrin.gif
Back to top
View user's profile Send private message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Wed Apr 22, 2009 2:26 am
Reply with quote

Here is when it causes the problem when I'm testing through the intertest:

When I do this move - MOVE WS-PASS-FIELDS TO DFHCOMMAREA,
or even if I try to move induvidual fields to LS-....
I get the storage violation


Code:
01  DFHCOMMAREA.                       
 02 LS-PASS-FIELDS.                   
   05 LS-GROUP            PIC X(3).   
   05 LS-SUBGROUP         PIC X(15).   
   05 LS-VER-AND-REL.                 
    10 LS-VER-REL-NOW   PIC X(2).     
 05 LS-RET-CD           PIC X(1).     
 05 LS-ERR-MSG          PIC X(30).     

01  LS-CDE-AREA          PIC X(487).

PROCEDURE DIVISION USING DFHEIBLK DFHCOMMAREA.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 2:47 am
Reply with quote

Quote:
I get the storage violation
In the called or calling program?
What does the call in the calling program look like?
Use "Code"......
Back to top
View user's profile Send private message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Wed Apr 22, 2009 3:22 am
Reply with quote

Storage problem is in the called program.
In the calling prog it does "call pgmsub using ws-fields" which should come into my LS-PASS-FIELDS (dfhcommarea)
what I showed above is in the called one.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 22, 2009 3:27 am
Reply with quote

I guess I'm from the "Old School", but when I first began coding CICS Dynamic Calls (late 80's), I used the following syntax -

Code:

CALL WS-SUB-PROGRAM USING DFHEIBLK, DFHCOMMAREA, WS-WHATEVER.

In the WS-SUB-PROGRAM (LINKAGE SECTION) I coded -
Code:

LINKAGE SECTION.
01  LS-WHATEVER PIC X(????).

The sub-program was translated and compiled and the translator will automatically create/insert DFHEIBLK and build a one-byte dummy DFHCOMMAREA.
In the sub-program PROCEDURE DIVISION, I only coded -
Code:

PROCEDURE DIVISION USING LS-WHATEVER.

The translator will automatically insert DFHEIBLK and DFHCOMMAREA before LS-WHATEVER, resulting in -
Code:

PROCEDURE DIVISION USING DFHBLK DFHCOMMAREA LS-WHATEVER.

The trick is not to address DFHCOMMAREA, because there may not have been allocated by the Calling program and you'll avoid a S0C4, which is probably the abend being raised. All you really need to do is to address the third parm, LS-WHATEVER. Addressability to DFHEIBLK has already been done for you.

Using this method, there is a way to access this sub-program via a LINK-API or CALL, by giving the sub-program some intelligence, which I'll leave for another time.

Just my .02 cents....

Regards,
Back to top
View user's profile Send private message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Wed Apr 22, 2009 5:22 am
Reply with quote

Thanks. I'll try it tomorrow.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 22, 2009 5:32 am
Reply with quote

The CICS Programming Guide (link at the top of the page) says in section 1.3.4.2:
Quote:
Dynamic COBOL call
The CALL statement may pass DFHEIBLK and DFHCOMMAREA as the first two parameters, if the called program is to issue EXEC CICS requests, or the called program can issue EXEC CICS ADDRESS commands. The COMMAREA is optional but if other parameters are passed, a dummy COMMAREA must also be passed. If the called subprogram uses 24-bit addressing and any parameter is above the 16MB line, COBOL issues a message and abends (1033) .
so I suspect if you have more trouble tomorrow after trying Bill's idea, you may want to post the calling program statement as well as the linkage section and PROCEDURE DIVISION statement of the called program. The requirements appear to depend upon what your called program is doing.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 6:04 am
Reply with quote

You are calling a subroutine with one variable?
Quote:
call pgmsub using ws-fields
And expecting addressability to a second variable?
Try "call pgmsub using DFHEIBLK DFHCOMMAREA ws-fields" and "PROCEDURE DIVISION USING DFHEIBLK DFHCOMMAREA ws-fields"......
Back to top
View user's profile Send private message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Wed Apr 22, 2009 6:20 am
Reply with quote

Sorry, I do have these 2 (DFHEIBLK DFHCOMMAREA) just didn't put here...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 22, 2009 6:33 am
Reply with quote

Quote:

Sorry, I do have these 2 (DFHEIBLK DFHCOMMAREA) just didn't put here...
Not to beat a dead horse or anything, but why do people insist on posting what they think is relevant instead of everything that is part of their problem? Let the people who have done these things a few times go through the data -- we can sift wheat from chaff! By not posting the exact data, you risk leading everybody down a side path that could so easily have been avoided by posting the original code from the start.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 6:37 am
Reply with quote

Felix61 wrote:
Sorry, I do have these 2 (DFHEIBLK DFHCOMMAREA) just didn't put here...
Dang, newbees.... icon_rolleyes.gif
Put in the called program, when first 'awakened' move the using addresses to a comp fields compatible with pointers and display them. See where the move is going.
Back to top
View user's profile Send private message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Wed Apr 22, 2009 7:22 am
Reply with quote

Well, the calling program is not that important to me. I do the subprog, and as I explained, I can't move fields into LS area so the'd be passed back up. That was the original queshtion. I think that Bill has a point here. Will test tomorrow and see.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 22, 2009 3:48 pm
Reply with quote

Quote:
Well, the calling program is not that important to me


it should be, that is what defines the linkage in the CALLed module.

1. there is the old way of a COBOL CALL, where the normal cics control blocks are passed (and received - by running the CALLed program thru the CICS precompiler - even if there are no CICS API CALLs made).

and

2. the CALLing program populates a structure that is passed (only thing passed) to the CALLed program - which is not run thru the CICS Precompiler, because why would you COBOL CALL a program that is going to issue CICS API CALLs?

suggest you look at other sub-programs at your shop and see what convention they are using, and copy the same.

once you have determined how your site codes, return here and members can offer advice - based on your requirement, which you do not seem to understand.
Back to top
View user's profile Send private message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Thu Apr 23, 2009 2:24 am
Reply with quote

I checked other programs and they do similar to what Bill stated earlier. I guess I'll have to wait until the calling program is ready and than see how they'll run togather instead of just run subpgm by CECI...
Thanks.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Apr 23, 2009 6:11 am
Reply with quote

Felix,

Because you're CALLING the sub-program from a main-program, you won't be able to directly test this sub-program using CECI. You can only access it using a CICS-API, such as a LINK.

Regards,
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 23, 2009 6:19 am
Reply with quote

Bill O'Boyle wrote:
Because you're CALLING the sub-program from a main-program, you won't be able to directly test this sub-program using CECI. You can only access it using a CICS-API, such as a LINK.
Huh? If the sub-program has EXEC CICS commands in it, yes, you will be able to directly test it.
Back to top
View user's profile Send private message
Felix61

New User


Joined: 09 Apr 2009
Posts: 14
Location: NJ

PostPosted: Thu Apr 23, 2009 7:08 am
Reply with quote

ceci link prog(prog)
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 23, 2009 7:19 am
Reply with quote

CICS Guy wrote:
If the sub-program has EXEC CICS commands in it, yes, you will be able to directly test it.
Felix61 wrote:
ceci link prog(prog)
The remark was not directed to you, but the called sub-program, not calling program.....
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Apr 23, 2009 10:44 am
Reply with quote

If the sub-program is being passed three parms, with the third parm representing the actual data (IE: LS-WHATEVER) and DFHCOMMAREA representing the commarea of the Caller (which he's not going to touch), then I'm confused.

This would only prove that he can address the DFHCOMMAREA data and not the third-parm data, which is where the S0C4 was being raised.

Regards,
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Apr 23, 2009 4:15 pm
Reply with quote

I guess I misunderstood and that Felix is going to wait until the calling (main) program is completed, then he'll use CECI to LINK to the calling program, which will CALL the sub-program.

I thought he was going to attempt to access the sub-program directly using CECI and that's where is I was scratching my head.

OK (CECI <---> Calling Program <---> Sub-Program) makes sense.

Regards,
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Using API Gateway from CICS program CICS 0
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top