Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sub program which has to pass data back to the calling pgm
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: Sub program which has to pass data back to the calling pgm
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: 2150
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 1:48 am    Post subject: Re: Call in CICS?
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 22, 2009 1:55 am    Post subject: Reply to: Call in CICS?
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    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 2:47 am    Post subject:
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    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 22, 2009 3:27 am    Post subject: Reply to: Call in CICS?
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    Post subject: Reply to: Call in CICS?
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: 7905
Location: Bellevue, IA

PostPosted: Wed Apr 22, 2009 5:32 am    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 6:04 am    Post subject:
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    Post subject:
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: 7905
Location: Bellevue, IA

PostPosted: Wed Apr 22, 2009 6:33 am    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Wed Apr 22, 2009 6:37 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Apr 23, 2009 6:11 am    Post subject: Reply to: Sub program which has to pass data back to the cal
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: 2150
Location: At my coffee table

PostPosted: Thu Apr 23, 2009 6:19 am    Post subject: Re: Reply to: Sub program which has to pass data back to the
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    Post subject:
Reply with quote

ceci link prog(prog)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us