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

Loading assembler table in COBOL Batch module


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
guy jax

New User


Joined: 05 Feb 2015
Posts: 2
Location: USA

PostPosted: Mon Mar 16, 2015 4:58 am
Reply with quote

Hi,

I have an assembler table, which is being used in a CICS COBOL module, it is being loaded using an EXEC CICS load command, I want to use the same table in a batch COBOL module.. Is there any way to achieve this… Something like a LOAD EPLOC which simply returns me the table address.

Any pointer would be appreciated…
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: Mon Mar 16, 2015 4:35 pm
Reply with quote

Review the following -

ibmmainframes.com/viewtopic.php?p=236741&highlight=#236741

An update to this post -

IBM does not condone the usage of PROCEDURE-POINTER to load external tables, similar to the Assembler LOAD Macro.

The last time it was used (in my case) it work as advertised, but keep in mind if it stops working for whatever reason, IBM may not be there to back you.

HTH....
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Tue Mar 17, 2015 10:15 pm
Reply with quote

Code:
01 WS-TABLE-STORAGE.
  05 WS-TABLE-NAME              PIC X(08) VALUE 'XXXXXXXX'.
  05 WS-TABLE-POINTER           USAGE PROCEDURE-POINTER.
  05 FILLER                     REDEFINES WS-TABLE-POINTER.
    10 WS-TABLE-ADDRESS         USAGE POINTER.
    10 FILLER                   PIC X(04).

  05 WS-TABLE-INDEX             PIC 9(08) VALUE ZEROES.

  05 WS-TABLE-FLAG              PIC X(01) VALUE ' '.
    88 WS-TABLE-MATCH                     VALUE 'M'.
    88 WS-TABLE-ERROR                     VALUE 'E'.

  05 WS-LOADED-FLAG             PIC X(01) VALUE ' '.
    88 WS-TABLE-LOADED                    VALUE 'L'.
    88 WS-TABLE-FAILED                    VALUE 'F'.

LINKAGE SECTION.

your table field layout information here

01 PCT-XXX-TABLE.
  05 PCT-XXX-COUNT              PIC 9(04) VALUE ZEROES.
  05 PCT-XXX-ENTRY              OCCURS 0 TO 999 TIMES
                                           DEPENDING ON PCT-XXX-COUNT.
    10 PCT-XXX-XXXX            PIC X(XX) VALUE SPACES.
    10 PCT-XXX-XXXX            PIC X(XX) VALUE SPACES.

Procedure Division stuff

SET WS-TABLE-POINTER TO NULLS
SET WS-TABLE-POINTER TO ENTRY WS-TABLE-NAME

IF WS-TABLE-POINTER = NULLS
  ERROR
ELSE
  SET WS-TABLE-LOADED               TO TRUE
  SET ADDRESS OF PCT-xxx-TABLE TO WS-TABLE-ADDRESS
END-IF

IF WS-TABLE-LOADED
  PERFORM VARYING WS-TABLE-INDEX FROM 1 BY 1
    UNTIL WS-TABLE-MATCH OR WS-TABLE-ERROR

    DO TABLE MATCHING STUFF HERE

  END-PERFORM
END-IF
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Mar 18, 2015 1:14 pm
Reply with quote

Mickeydusaor,

Are you using an abend-handler as well? Otherwise what is the purpose of the NULL setting and the test for NULL? If it isn't there, or busted, you'll just get S806 or S706.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Wed Mar 18, 2015 7:02 pm
Reply with quote

Bill,

Yes all of the programs handle I/O and any other type of errors in this shop.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Mar 18, 2015 7:47 pm
Reply with quote

Well, what I meant was "Are you using a Language Environment Abend-handler to get control for an S706/S806?"

Code:
SET WS-TABLE-POINTER TO NULLS
SET WS-TABLE-POINTER TO ENTRY WS-TABLE-NAME

IF WS-TABLE-POINTER = NULLS
  ERROR


Without the abend-handler, if the contet of WS-TABLE-NAME does not exist in the STEPLIB/JOBLIB you will get S806, and if it is not correctly linkedited/bindered you'll get an S706.

With an abend-handler, the SET WS-TABLE-POINTER TO NULLS would be correct, the SET WS-TABLE-POINTER TO ENTRY WS-TABLE-NAME would fail, the abend would be handled, and the WS-TABLE-POINTER would not change, so the IF would work.

Without an abend-handler, those things with the NULLS would be superfluous.

So I assume you have one. Perhaps.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Wed Mar 18, 2015 8:02 pm
Reply with quote

Bill,

Yes I did write an Abend handler here just for some of these reason.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Mar 18, 2015 8:22 pm
Reply with quote

OK, thanks. Now future readers will know.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts Load new table with Old unload - DB2 DB2 6
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 Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top