View previous topic :: View next topic
|
Author |
Message |
Richard Duggan
New User
Joined: 14 Apr 2010 Posts: 9 Location: Hartford, CT. USA
|
|
|
|
Code: |
IOAREA DSECT
RGUSEGLV DS C SEGMENT CODE FOR THIS SEGMENT
RGUMIGX EQU X'02' Migratx indicator for trailer @PQ40
RGUHSDF DS C DELETE FLAG USED BY HSAM
HSAMDFLG EQU X'80' FLAGS HSAM THIS SPECIAL FORMAT DB
RGTRAILR EQU X'90' Trailer/statistics record @PQ40
RGPART EQU X'01' Partitioned DB @PQ40
RGFALLBK EQU X'02' Fallback from partitioned DB @KW30
RGMIGRAT EQU X'04' Migration to partitioned DB @PQ36
RGSTAT40 EQU X'08' 40-byte stat record @PQ72
RGUHDRLN DS H LENGTH OF HEADER PORITION OF RECORD
RGUSEGLN DS H LENGTH OF DATA PORITION OF RECORD
RGUSEGNM DS CL8 SEGMENT NAME
RGUSEGDF DS C DELETE FLAG OF SEGMENT
RGUPFCTR DS XL4 COUNTER FIELD OF PREFIX
IOTWFOR DS XL4 LOGICAL TWIN FORWARD POINTER
IOTWBACK DS XL4 LOGICAL TWIN BACKWARD POINTER
IOPAR DS XL4 LOGICAL PARENT POINTER
IOOLD DS XL4 OLD LOCATION OF RECORD
IOSEG DS 0CL1 VARIABLE LENGTH DATA FIELD
RGULEN EQU *-IOAREA Prefix length
MEND
PIOAREA DSECT
PGUSGLEV DS C Segment code for this segment
PGUHSDFP DS C Flag byte to identify DB type
PGTRAILR EQU X'90' Trailer/statistics record @P
PGUTYPE EQU X'01' Indicates partitioned DB
PGUTYPF EQU X'02' Indicates fallback from HALDB @P
PGUTYPM EQU X'04' Indicates migration
PGUST40 EQU X'08' Indicates 40-byte stat record @P
PGUHDRLG DS H Length of header portion of record
PGUSEGLG DS H Length of data portion of record
PGUSGNAM DS CL8 Segment name
PGUSGDFG DS C Delete flag of segment
PGUPXCTR DS XL4 Counter field of prefix
PGUSGPID DS XL2 Partition ID
PGUSRGNB DS XL2 Reorganization number
PGUILK DS XL8 ILK OF SEGMENT
PGUPPTR DS XL28 POINTER SET IF LC
PGIOSEG DS 0CL1 Variable length data field
PGULEN EQU *-PIOAREA Prefix length
MEND |
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
I see the CSECTS/DSECTS, but where are the donations ?
( previous post edited to make it more readable with the code tags ) |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Ensure donations are not in Greek Drachma's....
Mr. Bill |
|
Back to top |
|
|
Richard Duggan
New User
Joined: 14 Apr 2010 Posts: 9 Location: Hartford, CT. USA
|
|
|
|
What do you wish as a donation? Our treasury is currently an empty tomb. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
That'll do nicely. Real-estate always has some value.
You wanted it in Klingon, or Cobol, I got confused now? |
|
Back to top |
|
|
Richard Duggan
New User
Joined: 14 Apr 2010 Posts: 9 Location: Hartford, CT. USA
|
|
|
|
COBOL is preferable and needed, although Klingon would be more interesting.
You can have the City of New Haven, it's murder rate keeps going up nightly. |
|
Back to top |
|
|
Dexter Morgan
New User
Joined: 11 Jan 2012 Posts: 3 Location: United States
|
|
|
|
Speaking of Klingons: (old 80s joke follows)
What do Starship Enterprise and toilet paper have in common????
Both circle Uranus looking for Klingons.
****************************************************************
But seriously,
Assembler tip 1:
Instead of coding
CLC 9(3,R4),=C'CLC'
code CLC =C'CLC',9(R4)
you do not have to supply length because assembler calculates from literal
NOTE: assuming assembler op code starts in 10 I believe is wrong. I think it can start in pos. 2 until 10 with no label and pos. 3 until 10 with label.
Assembler tip 2:
After every I/O and macro, test something to see if it worked.
Plain old tip 3:
Forget doing this!
There is a reason no one has done this successfully or even attempted this. You have to have decades of experience with assembler and macros to even attempt a manual conversion, let alone a programmatic conversion. Bit handling and, as mentioned earlier, TR and TRT not being available in any language except assembler and sheer complexity of macros are just a few of the many, many daunting problems.
Also, writing your program in COBOL would be much easier. All you are really doing in your assembler program is parsing words while trying to generate COBOL statements.
I think you are basically about 1/100th of the way started. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I think this is about it for the first one. I have made all the binary (comp) fields unsigned, which I imagine matches your data, if not replace 9 with S9. I have used 9(8) for the word-sized binaries. I suggest only changing to (9) if you need all the digits. (9) is the worst size of COMP to do any 'rithmatic with.
The second record is straigthforward except for these two:
Code: |
PGUILK DS XL8 ILK OF SEGMENT
PGUPPTR DS XL28 POINTER SET IF LC
|
I should think
Code: |
05 PGUPPTR-POINTER-SET-IF-LC.
10 PGUPPTR-IF-LC-PTR COMP PIC 9(8) OCCURS 7 TIMES.
|
Is the ILK a huge number or two smaller ones, or what? Other than that I think you've got enough to do the second record yourself, after all, it is only New Haven.
On that, how are we going to work this? Do I just contact the Mayor's office and he signs over the deeds? Does it include both the Universities?
I got burned in a deal like this once before. I swapped an OCCURS DEPENDING ON definition for the Brooklyn Bridge. Turned out it was a scam, though I don't know what the other guy thought he got out of it. I hope this doesn't go the same way.
Code: |
01 A-NICE-RECORD-NAME.
05 RGUSEGLV-SEGMENT-CODE PIC X.
88 RGUMIGX0-MIGRATX-IND-FOR-TRLR VALUE X'02'.
05 RGUHSDF-DELETE-FLAG-BY-HSAM PIC X.
88 HSAMDFLG-HSAM-SPECIAL-FM-DB VALUE X'80'.
88 RGTRAILR-TRLR-STATS-RECORD VALUE X'90'.
88 RGPART-PARTITIONED-DB VALUE X'01'.
88 RGFALLBK-FBACK-FROM-PRTND-DB VALUE X'02'.
88 RGMIGRAT-MIGR-TO-PARTND-DB VALUE X'04'.
88 RGSTAT40-40-BYTE-STAT-RECORD VALUE X'08'.
05 RGUHDRLN-LEN-HEAD-PORTN-REC COMP PIC 9(4).
05 RGUSEGLN-LEN-DATA-PORTN-REC COMP PIC 9(4).
05 RGUSEGNM-SEGMENT-NAME PIC X(8).
05 RGUSEGDF-DELETE-FG-OF-SEGMENT PIC X.
05 RGUPFCTR-CNTER-OF-PREFIX COMP PIC 9(8).
05 IOTWFOR-LOGICAL-TWIN-FWD-PTR COMP PIC 9(8).
05 IOTWBACK-LOGICAL-TWIN-BWD-PTR COMP PIC 9(8).
05 IOPAR-LOGICAL-PARENT-PTR COMP PIC 9(8).
05 IOOLD-OLD-LOCATION-OF-RECORD COMP PIC 9(8).
|
|
|
Back to top |
|
|
ConradSteg
New User
Joined: 22 Jun 2012 Posts: 1 Location: USA
|
|
|
|
Bill;
So that you don't have to depend on what is specified for NUMPROC when the COBOL code is compiled, it's better to use S9(9) COMP-5 instead of S9(8) COMP. That way you will actually produce code that is functionally equivalent to the assembler code, i.e. it won't lop off the most significant digits if the number being stored is greater than 99,999,999.
Others have also said that there is no COBOL equivalent to TR. I beg to differ; INSPECT string CONVERTING string2 TO string3 will generate a TRanslate. I frequently use it to convert LOW-VALUES to SPACES and lower-case to upper-case.
For example,
INSPECT FIRST_NAME
CONVERTING
X'00818283848586878889919293949596979899A2A3A4A5A6A7A8A9'
TO ' ABCDEFGHIJKLMNOPQRSTUVWXYZ'
is equivalent to
Code: |
TRTAB DC 256AL1(*-TRTAB) STANDARD TRANSLATE TABLE
ORG TRTAB
DC C' '
ORG TRTAB+C'a' (or +X'81')
DC C'ABCDEFGHI'
ORG TRTAB+C'j' (or +X'91')
DC C'JKLMNOPQR'
ORG TRTAB+C's' (or +X'A2')
DC C'STUVWXYZ'
ORG ,
.
.
.
TR FIRST_NAME,TRTAB (assuming HLASM) |
In the old days of COBOL, TRANSFORM did the same thing.
Conrad |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Welcome Conrad.
NUMPROC doesn't affect binary fields. Perhaps you meant TRUNC?
In 2 1/2 years the OP has not complained. Without seeing the Assembler code, we can't tell if there is full use of the bits in any F's or H's. If there was full use, COMP-5 would be required. If not, not. since COMP-5 tends to generate more instructions than COMP and its aliases, I only use/recommend it when it is actually required.
You are correct about the INSPECT. Mr Bill is a regular advocate here of INSPECT ... CONVERTING ... with literals for that type of thing and other uses. (Without the literals, different code is generated). |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
I try to avoid ORG, though that won't stop me. This is very hard to type, but ...
Code: |
TRTAB DC 0XL256'0',C' ',(C'a'-(*-TRTAB))AL1(*-TRTAB),C'ABCDEFGHI'>
,(C'j'-(*-TRTAB))AL1(*-TRTAB),C'JKLMNOPQR',(C's'-(*-TRTA>
B))AL1(*-TRTAB),C'STUVWXYZ',(256-(*-TRTAB))AL1(*-TRTAB) |
This is the same, and it's easier to type.
Code: |
TRTAB2 DC 0XL256'0',C' ',(C'a'-(*-TRTAB2))AL1(*-TRTAB2)
DC C'ABCDEFGHI'
DC (C'j'-(*-TRTAB2))AL1(*-TRTAB2)
DC C'JKLMNOPQR'
DC (C's'-(*-TRTAB2))AL1(*-TRTAB2)
DC C'STUVWXYZ'
DC (256-(*-TRTAB2))AL1(*-TRTAB2) |
Instead of something like C'j' you can use C'J'-X'40'. That will work fine if you are using ORG instructions, but it does get clumsy in the complex DC instructions I've sort of fallen in love with.
If you really want to be clever, change something like C'ABCDEFGHI' to 9AL1(*-TRTAB+X'40').
Code: |
TRTAB3 DC 0XL256'0'
ORG TRTAB3
DC C' ',(256-(*-TRTAB3))AL1(*-TRTAB3)
ORG TRTAB3+C'A'-X'40'
DC 9AL1(*-TRTAB3+X'40')
ORG TRTAB3+C'J'-X'40'
DC 9AL1(*-TRTAB3+X'40')
ORG TRTAB3+C'S'-X'40'
DC 8AL1(*-TRTAB3+X'40')
ORG , |
One serious flaw with all these translate tables is they wont't translate non-printables (except for X'00') to blanks, but I'll leave that as an exercise for all you lurkers out there who probably won't bother to try to understand these instructions. |
|
Back to top |
|
|
|