|
View previous topic :: View next topic
|
| Author |
Message |
gylbharat
Active Member
.jpg)
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi,
I am trying to generate the SYMNAMES using COBDFSYM. However I am not able to generate the SYMNAMES for the occurs clause.
Example : Copybook
| Code: |
01 XXX-RECORD.
03 XXX-BEGIN.
05 FILE-SIZE PICTURE S9(4) COMP.
05 FILE-NAME PICTURE X(2).
03 XXX-KEY.
05 KEY-G2-VARI PICTURE X(50).
05 FILLER REDEFINES KEY-G2-VARI.
10 KEY-G2Y.
15 KEY-XXX-ACCT PICTURE S9(15) COMP-3.
15 KEY-XXX-DATE PICTURE S9(8) COMP.
15 FILLER PICTURE X(38).
03 XXX-DATA.
05 XXX-LST-CHG-DATE PICTURE S9(8) COMPUTATIONAL.
05 XXX-LEVEL-EACH OCCURS 02 TIMES
INDEXED BY XXX-LEVL-INDEX.
10 XXX-LEVEL-IND PICTURE 9.
10 XXX-REPT-EACH OCCURS 03 TIMES
INDEXED BY XXX-REPT-INDEX.
15 XXX-REPT-PERCENT
PICTURE S9(03)V9(06) COMP-3.
|
Output SYMNAMES Generated:
| Code: |
XXX-RECORD,1,90,CH
XXX-BEGIN,1,4,CH
FILE-SIZE,1,2,FI
FILE-NAME,3,2,CH
XXX-KEY,5,50,CH
KEY-G2-VARI,5,50,CH
KEY-G2Y,5,50,CH
KEY-XXX-ACCT,5,8,PD
KEY-XXX-DATE,13,4,FI
XXX-DATA,55,36,CH
XXX-LST-CHG-DATE,55,4,FI
XXX-LEVEL-EACH,59,16,CH
_1,1,Index-Nam,CH
XXX-LEVEL-IND,59,1,ZD
XXX-REPT-EACH,60,5,CH
_2,1,Index-Nam,CH
XXX-REPT-PERCENT,60,5,PD
|
We can see that for the occurs clause the SYMNAMES have _1,1,Index-Nam,CH .
Can any one let me know how to generate the SYMNAMES correctly when the copybook have occurs clause?
Thanks in Advance. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Nice to see someone using SYMNAMES :-)
The OCCURS cannot be directly reflected, no subscripting in the Sort products. You have a little extra manual or programmatic effort to give each occurence a unique name.
For the data definition try:
| Code: |
FIELD-1,30,7,PD
FIELD-2 *,=,=
FIELD-3 *,=,= |
The * will use the next available start position (37 for FIELD-2) and the = will "copy" the information at that position from the previous field, so all the lengths and types will be the same, without explicit coding.
Everything can be checked in the SYMNOUT where it will have been expanded to the actual position, lenght and type. |
|
| Back to top |
|
 |
gylbharat
Active Member
.jpg)
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
| Thanks Bill |
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| Are you doing this in Rexx? |
|
| Back to top |
|
 |
gylbharat
Active Member
.jpg)
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Hi Nic,
COBDFSYM is a Rexx routine provided by IBM to generate SYMNAMES from cobol copybook. But this routine is not handling Occurs clauses properly... |
|
| Back to top |
|
 |
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 767 Location: Whitby, ON, Canada
|
|
|
|
I have noticed small glitches in COBDFSYM too. IBM provides it 'as is', and you are free to change it if you wish.
For instance, I fixed an issue affecting variable sized groups. (Unfortunately I don't remember what the problem was). I also added a couple of input parameters, one to indicate the starting offset (handy for VB files) and other to control whether to use hyphen (-) or underscore (_) in the symbol names.
I also added a feature to generate a MAPDEF structure (it is something that can be used by REXX IMS to parse IMS segments).
Anyway, my point is that if COBDFSYM doesn't work the way you want it to, then change it. It's Rexx, not rocket science.  |
|
| Back to top |
|
 |
mbizzle
New User
Joined: 06 May 2020 Posts: 7 Location: United States
|
|
|
|
I registered just so I could share this fix to COBDFSYM.
I had been using it for a few years now, and loved it and was sad when our upgrade from cobol compiler V4 to V6 bricked this program. Luckily, it was a fairly simple fix to update it.
Here are the fixes you need to make to allow it to be compatible with the V6 (and i assume V5) compilers.
I am posting this on a few forums so that others may find it that have the same issue.
change this line
parse var line 92 asmdef datatyp .
to
parse var line 87 asmdef datatyp .
and add this line
do until left(line,1) = '1'
call Put_line
parse pull line
if pos('End of Data Division Map',line)<> 0 then leave
end |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|