View previous topic :: View next topic |
Author |
Message |
BigDaddy Beginner
Joined: 05 Nov 2004 Posts: 18 Topics: 5 Location: AMERICA
|
Posted: Thu Apr 12, 2007 12:24 pm Post subject: How to get the length of a called program from a cobol pgm |
|
|
I have a batch cobol program that needs to bump through a table that is really a assembler pgm. I can get the address of the beginning of the table buy using a procedure pointer and doing the following.
SET called-pgm-pointer TO ENTRY ws-called-pgm
What I need to be able to do is bump through the table/pgm and stop when I get to end but I have no way of knowing the length of the table/pgm. Does anybody have any ideas on getting the length of the called table/pgm?
TIA. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Apr 12, 2007 1:39 pm Post subject: |
|
|
way back when (1960's, 70's, 80's) when we created a table with assembler, the first item was always an S9(9) comp field that equated to the length of the table (area) - 4 (first item) divided by the length of an item (second - thru the last-field). That way, each time the assembler prgm was recompiled (new item) the counter was automatically
increased (or decreased) without having to rely on the programmer to adjust the counter. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
BigDaddy Beginner
Joined: 05 Nov 2004 Posts: 18 Topics: 5 Location: AMERICA
|
Posted: Thu Apr 12, 2007 2:10 pm Post subject: |
|
|
Thanks dinosauer, that is a good idea. Wish I had thought of that in the beginning when I created the assembler tables. My stuff is already in our production so I was trying to get around have to make that change. I have done that in the past but I didn't even think about it, I guess I am getting old.
Kolusu, so you are saying I can do.... LENGTH OF ws-called-pgm? Wouldn't that just give me back the length of the ws field (8)? Am I missing something? |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Apr 12, 2007 3:31 pm Post subject: |
|
|
BigDaddy,
Enterprise Cobol is near Assember-COBOL compared to VS COBOL. The usage of the SET statement is greatly expanded. I had not bothered to read the EntCOBOL manual. thx to your question, I will read it with care.
Unfortunately I don't think LENGTH of is going to work. If you could adequately describe your table (ASM Module) you would not have the problem that you do now.
I assume you want to make as few changes as possible --- to be able to effortlessly and flawlessly bump thru your table.
Is there no recognizable delimiter within an ASM-Load module? has the object NO length entry before the ENTRY Point?
Way I see it, unless you are willing to redo all your tables, you are going to have to code something in your COBOL module to 'read' the ASM load module for which you receive an ENTRY ADDRESS. I find it hard to believe there is no delimiter for an ASM Object generated by the compiler or that there is no Length - VLI within the ASM Object.
Anyway, interesting problem.
How do you address your COBOL table definition to the procedure-pointer? Do you cheat and redefine and move/or use the value as a regular pointer? _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Fri Apr 13, 2007 6:07 am Post subject: |
|
|
bigdaddy,
My apolozies. I did not understand the question correctly
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
BigDaddy Beginner
Joined: 05 Nov 2004 Posts: 18 Topics: 5 Location: AMERICA
|
Posted: Fri Apr 13, 2007 9:17 am Post subject: |
|
|
Dino, I had to breakdown and change the table. I went I little futher and added 3 fullwords to the beginning of the table, the first one has the addr of the beginning of the table, the second has the length of a entry and the third has the addr of the end of the table. And to answer you question I do cheat and redefine the procedure pointer as a pointer. I can post what I did if you guys think it would be beneficial.
FYI, I did try to just bump though the table till I hit low values but I got the great S0C4. |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Apr 13, 2007 9:36 am Post subject: |
|
|
BigDaddy,
as a matter of fact, would like to see the code used to address your table def to the 'loaded module' via procedure-ptr.
actually, I wish to copy and keep it as reference material. my only question is, why does IBM NOT provide this in the SET formats?. That I will research. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
BigDaddy Beginner
Joined: 05 Nov 2004 Posts: 18 Topics: 5 Location: AMERICA
|
Posted: Fri Apr 13, 2007 10:31 am Post subject: |
|
|
here is the assembler table...
Code: |
//S1 EXEC PROC=ASMHCL
//ASM.SYSIN DD *
XXXX TITLE 'TABLE OF MODELS'
XXXXCBTB CSECT
DS 0F
DC A(MODELTB),A(MODELTBL),A(MODELTBE)
*------------------------------------------------*
* TABLE .......BUR MODEL XL NAME...... *
*------------------------------------------------*
MODELTB EQU *
DC CL32'CB CP* 02 CANADIAN BEACON NAL '
MODELTBL EQU *-MODELTB
DC CL32'CB CPE 02 ENHANCED BEACON '
DC CL32'CB CPA 05 ENHANCED BEACON-AU '
DC CL32'CB CPB 08 ENHANCED BEACON-BC '
DC CL32'CB CPF 06 ENHANCED BEACON-PF '
MODELTBE EQU *
*
*-------------------------------------*
END
//LKED.SYSLMOD DD DSN=BCST.XXXXXX.LOADLIB,DISP=SHR
//LKED.SYSIN DD *
NAME XXXXCBTB(R)
//* |
|
|
Back to top |
|
 |
BigDaddy Beginner
Joined: 05 Nov 2004 Posts: 18 Topics: 5 Location: AMERICA
|
Posted: Fri Apr 13, 2007 10:47 am Post subject: |
|
|
here is the cobol code...sorry about the crude format, I was in a hurry.
work storage...
Code: |
01 WS-POINTERS.
05 CB-XLAT-MODULE-INFO.
10 CB-XLAT-POINTER PROCEDURE-POINTER.
05 REDEFINES CB-XLAT-MODULE-INFO.
10 CB-XLAT-ADDRESS POINTER.
05 TABLE-POINTER POINTER.
05 TABLE-POINTER-REDEF REDEFINES TABLE-POINTER.
10 TABLE-POINTER-NUMERIC PIC 9( 08 ) COMP-5.
05 SAVE-BEGIN-CB-TABLE-ADDR POINTER.
05 SAVE-END-CB-TABLE-ADDR POINTER.
linkage..
*
01 TABLE-INFO.
05 TABLE-BEGIN-ADDR POINTER.
05 TABLE-ENTRY-LENGTH POINTER.
05 TABLE-END-ADDR POINTER.
*
01 TABLE-LAYOUT.
05 MODEL-TABLE-ENTRY.
10 TBL-BUREAU-ID PIC X(2).
10 TBL-FILL1 PIC X(1).
10 TBL-RISK-MODEL-ID PIC X(5).
10 TBL-FILL2 PIC X(1).
10 TBL-RISK-MODEL-XLATE PIC X(2).
10 TBL-FILL3 PIC X(1).
10 TBL-RISK-MODEL-DESC PIC X(20).
*
code...
SET CB-XLAT-POINTER TO ENTRY WS-CB-TABLE
SET ADDRESS OF TABLE-INFO TO CB-XLAT-ADDRESS
SET SAVE-BEGIN-CB-TABLE-ADDR TO TABLE-BEGIN-ADDR
SET SAVE-END-CB-TABLE-ADDR TO TABLE-END-ADDR
SET TABLE-POINTER TO SAVE-BEGIN-CB-TABLE-ADDR
SET NOT-END-OF-MODEL-TBL TO TRUE
PERFORM UNTIL END-OF-MODEL-TBL
SET ADDRESS OF TABLE-LAYOUT TO TABLE-POINTER
IF TABLE-POINTER EQUAL SAVE-END-CB-TABLE-ADDR
SET END-OF-MODEL-TBL TO TRUE
ELSE
MOVE TBL-RISK-MODEL-DESC TO OUT-MODEL-NAME
MOVE TBL-RISK-MODEL-ID TO OUT-BUREAU-MODEL-ID
MOVE TBL-RISK-MODEL-XLATE TO OUT-TSYS-MODEL-ID
PERFORM WRITE-OUT-REC
PERFORM LOOKUP-CB-REASONS
ADD LENGTH OF MODEL-TABLE-ENTRY TO
TABLE-POINTER-NUMERIC
END-IF
END-PERFORM
|
|
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Apr 13, 2007 11:04 am Post subject: |
|
|
BigDaddy,
thx. i am going to follow-up and try to determine why IBM ENT COBOL does NOT provide a valid SET format. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Mon Apr 16, 2007 8:31 am Post subject: |
|
|
BigDaddy,
though it is a 'non-subject' now, the binder APIs to return information - if you have read access to the data set where the module resides.
The other advantage of the Binder APIs is they work for program objects in PDSE data sets as well as load modules. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Mon Apr 16, 2007 11:46 pm Post subject: |
|
|
For masochists, you could also run the cde control blocks. Somewhere in there is the address and length of the loaded module. usually done in assembler, but can be done in COBOL with a bit of pain. |
|
Back to top |
|
 |
BigDaddy Beginner
Joined: 05 Nov 2004 Posts: 18 Topics: 5 Location: AMERICA
|
Posted: Tue Apr 17, 2007 8:48 am Post subject: |
|
|
Dino, I do have read access to the loadlib. I might give that a try. This is what happens when you take a old mainframe assembler guy and make him do cobol.
Thanks all for the info |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Apr 17, 2007 1:15 pm Post subject: |
|
|
I should have mentioned, my post assumed that the called pgm is a separate load module (which it sounds like it may be) and if so, then you could call an assembler stub to use CSVQUERY to get this information. Or call AMBLIST dynamically maybe. |
|
Back to top |
|
 |
|
|