Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Assembler Macro Copybook converted to COBOL with a few error

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

New User


Joined: 17 Dec 2015
Posts: 2
Location: South Africa

PostPosted: Tue Sep 26, 2017 3:07 am    Post subject: Assembler Macro Copybook converted to COBOL with a few error
Reply with quote

I went through the forum but could't find an answer to my question therefore this post. I am trying to convert an Assembler macro copybook to Cobol. The ASM copyboo is below:
Code:

         MACRO                                                         
                                                                      *
*  This DG 142 maps a BSAM file named CKPTDS                          *
*                                                                     *
*  Size:  4100                                                        *
*                                                                     *
***********************************************************************
         SPACE 2                                                       
P49$CSP  DSECT                                                         
CS$AC    DS    HL2                ACTION                               
CS$RSLT  DS    HL2                RESULT                               
CS$HEAD  DS    0F                 HEADER CONTROL FIELDS                 
***********************************************************************
* Header is in first record of CKPTDS only                            *
***********************************************************************
CS$JNME  DS    CL8                JOBNAME                               
CS$JSTP  DS    CL16               JOB STEPNAME/PROC STEP NAME           
CS$XACT  DS    0CL12              TRANSACTION ID                       
CS$COID  DS    HL2                  COMPANY                             
CS$APPL  DS    HL2                  APPLICATION                         
CS$FUNC  DS    HL2                  FUNCTION                           
CS$DATE  DS    PL4                VALUE FROM STCK INSTRUCTION           
CS$TIME  DS    PL4                                                     
CS$CKPID DS    CL8                DLI CHECKPOINT ID                     
CS$RSTR  DS    CL7                IF = 'RESTART ', THIS REC VALID       
CS$INIT  DS    X                  X'FF' - CHECKPOINT ACT. ISSUED BY PEM
CS$SACT  DS    FL4                IF CKPTING SORT, THE SORT OUT ACT ID 
CS$SCNT  DS    FL4                SORT RECORD COUNT                     
         SPACE                                                         
CS$NF    DS    HL2                NUMBER FILE ENTRIES, THIS RECORD     
CS$NDG   DS    HL2                NUMBER DATA GROUP ENTRIES, THIS REC   
CS$NUMR  DS    HL2                TOTAL BLOCKS/LOGICAL REC THIS CKPTDS 
CS$LHEAD EQU   *-CS$AC            LENGTH OF HEADER INFO                 
***********************************************************************
* File entries are found in first record of CKPTDS only               *
***********************************************************************
CS$ENTS  DS    0C                                                       
CS$FILES DS    0C                 FILE ENTRIES                         
CS$FIL   DS    CL8                FILE ID, THIS ENTRY                   
CS$NOTE1 DS    FL4                NOTE MACRO RESULTS, LAST IO           
CS$NOTE2 DS    HL2                RELATIVE VOLUME NUMBER               
CS$NOTE3 DS    HL2                RELATIVE LOG REC, THIS BLOCK         
CS$FLEN  EQU   *-CS$FILES         LENGTH, ONE FILE ENTRY               
***********************************************************************
* Data group entries start after file entries in first record.        *
* All other CKPTDS records are just DG entries.                       *
***********************************************************************
         ORG   CS$AC              USE 0 DISPLACEMENT                   
CS$DGS   DS    0C                                                       
CS$DGID  DS    FL4                DATA GROUP ID                         
CS$DGLEN DS    HL2                DATA GROUP LENGTH                     
CS$DGD   DS    0C                 CS$DGLEN BYTES OF DATA               
         SPACE 2                                                       
         MEND                                                           


While my attempted conversion yielded the below. Many fields are viewable but date and time not so. The occurrences at the bottom of the layout also is messed up to some extent. Any help would be sincerely appreciated.

Code:

01 P49$CSP.
   05 $AC      PIC S9(04) COMP.
   05 $RSLT      PIC S9(04) COMP.
   05 $HEAD.
      10 $JNME      PIC  X(08).
      10 $JSTP      PIC  X(16).
      10 $XACT      PIC  X(12).
      10 $COID          PIC S9(04) COMP.
      10 $APPL          PIC S9(04) COMP.
      10 $FUNC          PIC S9(04) COMP.
      10 $DATE          PIC S9(07) COMP-3.
      10 $TIME          PIC S9(07) COMP-3.
      10 $CKPID         PIC  X(08).
      10 $RSTR      PIC  X(07).
      10 $INIT          PIC  X.
      10 $ACT           PIC S9(09) COMP..
      10 $CNT           PIC S9(09) COMP..
      10 $NF            PIC S9(04) COMP.
      10 $NDG           PIC S9(04) COMP.
      10 $NUMR          PIC S9(04) COMP.
      10 $ENTS.
         15 $FILES OCCURS "NOT SURE HERE".
            20 $FIL     PIC  X(08).
            20 $NOTE1   PIC S9(09) COMP..
            20 $NOTE2   PIC S9(04) COMP.
            20 $NOTE3   PIC S9(04) COMP.
         15 $DGS OCCURS "NOT SURE HERE".
            20 $DGID    PIC S9(09) COMP..
            20 $DGLEN   PIC S9(04) COMP.
      10 $DGS2 REDEFINES $ENTS OCCURS "NOT SURE".
         15 $DGID2      PIC S9(09) COMP..
         15 $DGLEN2     PIC S9(04) COMP.
     
Back to top
View user's profile Send private message

steve-myers

Active Member


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

PostPosted: Tue Sep 26, 2017 6:37 am    Post subject:
Reply with quote

Well, I see several issues.

Your C$DATE and C$TIME fields are not the result of a STCK instruction. STCK stores a 64 bit binary value, so neither data area is packed decimal and C$DATE is not going to be a date. More likely C$DATE is sort of packed decimal in the form (in hex) 0cyydddF.

If you share a hexadecimal dump of C$TIME we can make an informed guess as to its meaning. One likely possibility is 8 packed decimal digits of the form hhmmssss. with no packed decimal sign. Another possibility is a binary time of day in 1/100th second units, with a maximum value of 0083D600.
Back to top
View user's profile Send private message
Ziquilix

New User


Joined: 17 Dec 2015
Posts: 2
Location: South Africa

PostPosted: Tue Sep 26, 2017 3:51 pm    Post subject:
Reply with quote

Hi Steve, thanks for your reply. I have below the hex values of C$DATE and C$TIME:

Code:

C$DATE = X'D3323AAE'
C$TIME = X'A76D9B06'
Back to top
View user's profile Send private message
steve-myers

Active Member


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

PostPosted: Tue Sep 26, 2017 6:54 pm    Post subject:
Reply with quote

Well, I concede that, together, they appear to be the result of a STCK instruction. I don't know any practical method available in Cobol to transform the value to a human usable date and time. Assembler programmers usually transform the value to the time of day clock equivalent of the local date and time as many shops store the time of day clock using GMT as a base, and then use the STCKTOD macro to create a more "normal" form of the date and time.

The first transformation is performed using two system provided values. These are usually fixed and change only when the local time changes between summer time and winter time. The STCKTOD macro is described in z/OS MVS Assm Services Reference for your z/OS release.

Running your TOD time without converting it to my local time through STCKCONV using TIMETYPE=DEC,DATETYPE=YYYYMMDD yields 08230160 30330000 20170926 00000000. The 20170926 is the date in 8 packed decimal digits, and 08230160 is the time of day, again, in 8 packed decimal digits. The 3033 after the time of day is additional precision, again in packed decimal digits. The entire program is
Code:
CNVTTOD CSECT
        USING *,12
        SAVE  (14,12)
        LR    12,15
        STCKCONV STCKVAL=TOD,CONVVAL=RESULT,                          ->
               TIMETYPE=DEC,DATETYPE=YYYYMMDD
        UNPK  WORD1(9),RESULT+00(5)
        UNPK  WORD2(9),RESULT+04(5)
        UNPK  WORD3(9),RESULT+08(5)
        UNPK  WORD4(9),RESULT+12(5)
        NC    WORD1,=8X'0F'
        NC    WORD2,=8X'0F'
        NC    WORD3,=8X'0F'
        NC    WORD4,=8X'0F'
        TR    WORD1,=C'0123456789ABCDEF'
        TR    WORD2,=C'0123456789ABCDEF'
        TR    WORD3,=C'0123456789ABCDEF'
        TR    WORD4,=C'0123456789ABCDEF'
        MVI   WORD1+L'WORD1,C' '
        MVI   WORD2+L'WORD2,C' '
        MVI   WORD3+L'WORD3,C' '
        LA    0,L'MSG
        LA    1,MSG
        TPUT (1),(0),R
        RETURN (14,12),RC=0
TOD     DC    X'D3323AAEA76D9B06'
RESULT  DC    XL16'0'
MSG     DC    0C'00000000 00000000 00000000 00000000'
WORD1   DC    C'00000000',C' '
WORD2   DC    C'00000000',C' '
WORD3   DC    C'00000000',C' '
WORD4   DC    C'00000000',C' '
        DC    0D'0'
        LTORG ,
        END   CNVTTOD
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Tue Sep 26, 2017 7:38 pm    Post subject: Reply to: Assembler Macro Copybook converted to COBOL with a few error
Reply with quote

as usual to understand an assembler csect
it is necessary to look also at the programs using it
unless needed for aligment and initialisations ( DC ) any <type> with the proper length will not make any difference to the program using it

anyway the dsect is murky ...

Code:
CS$XACT  DS    0CL12              TRANSACTION ID                       
CS$COID  DS    HL2                  COMPANY                             
CS$APPL  DS    HL2                  APPLICATION                         
CS$FUNC  DS    HL2                  FUNCTION                           
CS$DATE  DS    PL4                VALUE FROM STCK INSTRUCTION           
CS$TIME  DS    PL4                                                     


what is the use of the
Code:
CS$XACT  DS    0CL12


just count the bytes icon_cool.gif
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. ISREDIT Macro is not returning back t... nico_neoz CLIST & REXX 21 Sat Nov 18, 2017 7:40 pm
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us