Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Equiavlent Assembler Copybook for Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
ravi243

New User


Joined: 03 Aug 2011
Posts: 8
Location: Bangalore

PostPosted: Sat May 16, 2015 8:48 pm    Post subject: Equiavlent Assembler Copybook for Cobol
Reply with quote

Hi Everyone

Need help in creating Assembler copybook equivalent of Cobol in which there is a occurs with in Occurs.

Here is an example of cobol copyboook

Code:
01 A_array
    15 A      occurs 6 times
          20 B   PIC S9(07) COMP-3
          20 C   PIC S9(07) COMP-3
          20 D   PIC  X(03)
          20 E   occurs 12 times
               25 F  pic  X(12)
          20 G   PIC X(03)


I coded like below in assembler

Code:
A _ARRAY  DSECT
A     DS   6CL158
       ORG A
B     DS   PL4
C     DS   PL4
D     DS   CL3
E     DS    12CL12
       ORG  E
EA   DS    CL6
EB   DS    CL6
       DS    11CL12
F     DS    CL3
AL   DS    (*-A)  ==> Length of one array
      DS    5CL158==> 5 remaining entries
AN  DS    ((*-A)/L'A)==> NUMBER OF ARRAY ENTRIES



Could you please correct me if I am wrong. Thanks much for your help in advance!

Code'd
Back to top
View user's profile Send private message

ravi243

New User


Joined: 03 Aug 2011
Posts: 8
Location: Bangalore

PostPosted: Mon May 18, 2015 12:49 pm    Post subject: Equiavlent Assembler Copybook for Cobol
Reply with quote

Some one please correct me, there is something wrong with my changes but could not find the exact mistake. Thank you for your help!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon May 18, 2015 12:51 pm    Post subject: Reply to: Equiavlent Assembler Copybook for Cobol
Reply with quote

If something is wrong, paste your output and any diagnostic messages.

This doesn't look good: AL DS (*-A)
Back to top
View user's profile Send private message
ravi243

New User


Joined: 03 Aug 2011
Posts: 8
Location: Bangalore

PostPosted: Mon May 18, 2015 3:14 pm    Post subject:
Reply with quote

Thanks Bill for your reply,

We have some Compaction and expansion for the ASM layout. while compiling those modules I am getting below Error. SO I am not sure if there is an issue with Module or my layout change. Could you please help me in this. Thanks.

61310+*,ERROR: OP = 5CL158, OPL = 011CL12
** ASMA254I *** MNOTE *** 61311+ 8,ERROR: UNLABELED DS DOES PROPERLY END ARRAY

Thank You
Ravi
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon May 18, 2015 3:27 pm    Post subject: Reply to: Equiavlent Assembler Copybook for Cobol
Reply with quote

Please paste the full DSECT from the Assembler output listing, including any embedded messages, and any later messages on the listing.

Please also use the Code Tags to preserve spacing.

Look at the line I mentioned. If you want to Define Storage, you will need to do more. Do you instead just want to EQUate a value? And for the next one two lines later?
Back to top
View user's profile Send private message
ravi243

New User


Joined: 03 Aug 2011
Posts: 8
Location: Bangalore

PostPosted: Sat May 23, 2015 8:15 pm    Post subject:
Reply with quote

Hi Bill, Thanks much for your response, I am not sure If I can post assembler source here.. Sorry for that..SO I have tried changing like below code and it worked.


Code:
A     DS   6CL158
       ORG A
B     DS   PL4
C     DS   PL4
D     DS   CL3
E     DS    0CL144
       ORG  E
EA   DS    CL6
EB   DS    CL6
       DS    CL132
F     DS    CL3
AL   DS    (*-A)  ==> Length of one array
      DS    5CL158==> 5 remaining entries
AN  DS    ((*-A)/L'A)==> NUMBER OF ARRAY ENTRIES


Code'd
Back to top
View user's profile Send private message
steve-myers

Active User


Joined: 30 Nov 2013
Posts: 460
Location: The Universe

PostPosted: Sun May 24, 2015 3:26 am    Post subject:
Reply with quote

ravi243 wrote:
Hi Bill, Thanks much for your response, I am not sure If I can post assembler source here.. Sorry for that..SO I have tried changing like below code and it worked.


Code:
A     DS   6CL158
       ORG A
B     DS   PL4
C     DS   PL4
D     DS   CL3
E     DS    0CL144
       ORG  E
EA   DS    CL6
EB   DS    CL6
       DS    CL132
F     DS    CL3
AL   DS    (*-A)  ==> Length of one array
      DS    5CL158==> 5 remaining entries
AN  DS    ((*-A)/L'A)==> NUMBER OF ARRAY ENTRIES
Most assuredly, that code did not work. There are two Assembler errors in the code, and 1 completely unnecessary statement.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sun May 24, 2015 3:55 am    Post subject: Reply to: Equiavlent Assembler Copybook for Cobol
Reply with quote

Please show the documentation which would allow you to use a DS without a type.

You have an unnamed DS which is within the storage of the field referenced by the ORG. How are you aiming to use that?

How do you want to use the AL and AN symbols?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Sun May 24, 2015 4:09 am    Post subject: Reply to: Equiavlent Assembler Copybook for Cobol
Reply with quote

IMNSHO icon_cool.gif the proper way is ...

Code:

 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  8 Line(s) not Displayed
 000009 DSECTE   DSECT
 000010 F        DS    CL12
 000011 SIZEOFE  EQU   (*-DSECTE)
 000012 *
 000013 DSECTA   DSECT
 000014 B        DS    PL4
 000015 C        DS    PL4
 000016 D        DS    CL3
 000017 E        DS    12CL(SIZEOFE)
 000018 G        DS    CL3
 000019 SIZEOFA  EQU   (*-DSECTA)
 000020 *
 000021 S        DS    6CL(SIZEOFA)
 000022 SIZEOFS  EQU   (*-S)
 000023          END
 ****** **************************** Bottom of Data ****************************


to get
Code:

 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 60 Line(s) not Displayed
 000057  D-Loc  Object Code    Addr1 Addr2  Stmt   Source Statement
 000058  000000                00000 0000C     1 DSECTE   DSECT
 000059  000000                                2 F        DS    CL12
 000060                        0000C           3 SIZEOFE  EQU   (*-DSECTE)
 000061                                        4 *
 000062  000000                00000 00452     5 DSECTA   DSECT
 000063  000000                                6 B        DS    PL4
 000064  000004                                7 C        DS    PL4
 000065  000008                                8 D        DS    CL3
 000066  00000B                                9 E        DS    12CL(SIZEOFE)
 000067  00009B                               10 G        DS    CL3
 000068                        0009E          11 SIZEOFA  EQU   (*-DSECTA)
 000069                                       12 *
 000070  00009E                               13 S        DS    6CL(SIZEOFA)
 000071                        003B4          14 SIZEOFS  EQU   (*-S)
 000072                                       15          END
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 53 Line(s) not Displayed
 ****** **************************** Bottom of Data ****************************


if You change something in the inner dsects the final ds will be automatically adjusted
and You will need TWO register to navigate the inner ARRAYS/OCCURS

or even better
Code:

 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 10 Line(s) not Displayed
 000009 ECOUNT   EQU   12
 000010 DSECTE   DSECT
 000011 F        DS    CL12
 000012 SIZEOFE  EQU   (*-DSECTE)
 000013 *
 000014 ACOUNT   EQU   6
 000015 DSECTA   DSECT
 000016 B        DS    PL4
 000017 C        DS    PL4
 000018 D        DS    CL3
 000019 E        DS    (ECOUNT)CL(SIZEOFE)
 000020 G        DS    CL3
 000021 SIZEOFA  EQU   (*-DSECTA)
 000022 *
 000023 S        DS    (ACOUNT)CL(SIZEOFA)
 000024 SIZEOFS  EQU   (*-S)
 000025          END
 ****** **************************** Bottom of Data ****************************


to get the same result

Code:

 ****** ***************************** Top of Data ******************************
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 64 Line(s) not Displayed
 000061    Loc  Object Code    Addr1 Addr2  Stmt   Source Statement
 000062                        0000C           1 ECOUNT   EQU   12
 000063  000000                00000 0000C     2 DSECTE   DSECT
 000064  000000                                3 F        DS    CL12
 000065                        0000C           4 SIZEOFE  EQU   (*-DSECTE)
 000066                                        5 *
 000067                        00006           6 ACOUNT   EQU   6
 000068  000000                00000 00452     7 DSECTA   DSECT
 000069  000000                                8 B        DS    PL4
 000070  000004                                9 C        DS    PL4
 000071  000008                               10 D        DS    CL3
 000072  00000B                               11 E        DS    (ECOUNT)CL(SIZEO
 000073  00009B                               12 G        DS    CL3
 000074                        0009E          13 SIZEOFA  EQU   (*-DSECTA)
 000075                                       14 *
 000076  00009E                               15 S        DS    (ACOUNT)CL(SIZEO
 000077                        003B4          16 SIZEOFS  EQU   (*-S)
 000078                                       17          END
 - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 55 Line(s) not Displayed
 ****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Sun May 24, 2015 4:26 am    Post subject: Reply to: Equiavlent Assembler Copybook for Cobol
Reply with quote

sorry I had a finger check ...

in both examples add something like

Code:
 
...
...
...
000023 MAIN     CSECT
000024 S        DS    (ACOUNT)CL(SIZEOFA)
000025 SIZEOFS  EQU   (*-S)
...
...
...


to get
Code:

...
...
...
000077  000000                00000 003B4    15 MAIN     CSECT
000078  000000                               16 S        DS    (ACOUNT)CL(SIZEO
000079                        003B4          17 SIZEOFS  EQU   (*-S)
...
...
...


S the main <container> should be in a csect to reserve space
Back to top
View user's profile Send private message
ravi243

New User


Joined: 03 Aug 2011
Posts: 8
Location: Bangalore

PostPosted: Tue May 26, 2015 12:18 am    Post subject:
Reply with quote

Hi Bill,

Sorry to confuse you with sample code, Below Is the ACTUAL code Which I used

Code:
MQWERT_ARRAY DSECT     
MQWERT   DS    6CL188 
         ORG   MQWERT
MQCTUVLU DS    PL4     
MQCTUFVL DS    PL4     
MQCTUPRD DS    CL3     
MQCTUTYP DS    PL1     
MQCTUQTY DS    PL4     
MQCTUSES DS    PL4     
MQCTUSEA DS    0CL144 
MQCTUYR  DS   CL4     
MQCTUMNT DS   CL2     
MQCTUDAY DS   CL2     
MQCTUHR  DS   CL2     
MQCTUMIN DS   CL2           
MQCTPKS    DS   CL132                                         
*                                                             
MQCTUSTR DS    CL12         TYPE OF LAST EFFORT SENT           
MQCTUEND DS    CL12         TYPE OF LAST EFFORT SENT           
MQCTUAL  EQU   (*-MQWERT) LENGTH OF ONE ENTRY                 
         DS    5CL188       5 REMAINING ENTRIES               
MQCTUAN EQU   ((*-MQWERT)/L'MQWERT) NUMBER OF ARRAY ENTRIES


Code'd again
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue May 26, 2015 5:15 am    Post subject: Reply to: Equiavlent Assembler Copybook for Cobol
Reply with quote

Code:
01  MQWERT_ARRAY.   
    05  MQWERT OCCURS 6 TIMES.
        10  MQCTUVLU COMP-3 PIC 9(7).
        10  MQCTUFVL COMP-3 PIC 9(7).
        10  MQCTUPRD PIC XXX.
        10  MQCTUTYP COMP-3 PIC 9.
        10  MQCTUQTY COMP-3 PIC 9(7).
        10  MQCTUSES COMP-3 PIC 9(7).
        10  MQCTUSEA.
            15  MQCTUYR  PIC X(4).     
            15  MQCTUMNT PIC XX.
            15  MQCTUDAY PIC XX.     
            15  MQCTUHR  PIC XX.     
            15  MQCTUMIN PIC XX.           
            15  MQCTPKS    PIC X(132).                                         
        10  MQCTUSTR PIC X(12).
        10  MQCTUEND PIC X(12).


Is that approximately (excluding decimal places) how you expect your COBOL record-layout to look?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue May 26, 2015 7:38 pm    Post subject: Reply to: Equiavlent Assembler Copybook for Cobol
Reply with quote

One little tidbit to watch out for in the future (so you don't get burned) are Assembler aligned fields, such as halfwords (H), fullwords (F) and doublewords (D). Their counterparts in COBOL must be suffixed with SYNC.

HTH....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us