On Sat, 12 Dec 2015 15:25:46 -0500, Scott Ford <[email protected]> wrote:
>Fred,
>
>Do you happened to have an example of the Assembler Code? I want to build
>something similar , with the Assembler being a message table...
>
>
>Regards,
>Scott
Sorry I didn't reply to this sooner.
We have a few Assembler tables that are used by CICS COBOL programs that
generally follow a structure like this:
asmtab CSECT
NUMENT DC Y((LASTENT-FIRSTENT)/LENGENT
FIRSTENT EQU *
DC C'xxxxxxxxyyyyyyyy'
LENGENT EQU *-FIRSTENT
LASTENT EQU *
END asmtab
The Assembler tables are loaded in CICS with EXEC CICS LOAD, but I recently
found out that similar Assembler tables can be loaded and used by COBOL Batch
programs. Here is a sample COBOL program to load and use an Assembler table
defined like the one above:
Identification Division.
Program-ID.
TESTLOAD.
Author.
Dale R. Smith.
Date-Written.
Once Upon a Time.
Date-Compiled. Once Upon a Time.
Environment Division.
Configuration Section.
Source-Computer. IBM-370.
Object-Computer. IBM-370.
Data Division.
Working-Storage Section.
01 WS-TABLE-STORAGE.
05 WS-TABLE-NAME Pic X(8) Value 'DI000024'.
05 WS-TABLE-POINTER Function-Pointer.
05 WS-TABLE-DISPLAY Redefines WS-TABLE-POINTER.
10 WS-TABLE-ADDRESS Pointer.
05 WS-TABLE-INDX Pic S9(8) Comp Value +0.
05 WS-LOADED-FLAG Pic X Value 'F'.
88 WS-TABLE-LOADED Value 'L'.
88 WS-TABLE-FAILED Value 'F'.
Linkage Section.
01 PROG-PSB-TABLE.
05 PROG-PSB-COUNT Pic S9(4) Comp.
05 PROG-PSB-ENTRY Occurs 1 to 9999 Times
Depending on PROG-PSB-COUNT
Ascending Key PROG-ID
Indexed by PP-INDEX.
10 PROG-ID Pic X(8).
10 PSB-ID Pic X(8).
EJECT
Procedure Division.
Set WS-TABLE-POINTER to Nulls
Set WS-TABLE-POINTER to Entry WS-TABLE-NAME
If WS-TABLE-POINTER = Nulls
Display 'Unable to Load External Table ' WS-TABLE-NAME
Move +12 to RETURN-CODE
Goback
End-If
Display WS-TABLE-DISPLAY
Set WS-TABLE-LOADED to True
Set Address of PROG-PSB-TABLE to WS-TABLE-ADDRESS
Display 'Table Entries ' PROG-PSB-COUNT
Perform
Varying PP-INDEX from 1 by 1
Until PP-INDEX > PROG-PSB-COUNT
Set WS-TABLE-INDX to PP-INDEX
Display 'Index ' WS-TABLE-INDX
' Program ' PROG-ID (PP-INDEX)
' PSB ' PSB-ID (PP-INDEX)
End-Perform
Move +0 to RETURN-CODE
Goback
.
The half word that contains the number of entries can be used by COBOL in an
Occurs Depending clause.
--
Dale R. Smith