MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Advantages of Converting 24 to 31 Bit Address
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
reddy_niranjan
Beginner


Joined: 07 Jun 2004
Posts: 3
Topics: 1

PostPosted: Mon Jun 07, 2004 4:39 am    Post subject: Advantages of Converting 24 to 31 Bit Address Reply with quote

Hi,
I am working on Z/OS system right now. I have some programs with AMode=24 & RMode=24 and some programs with AMODE=31 & RMODE=Any. I came to know that If program with AMODE=24 calls Program with Amode=31 will abend.

Also i came to know that Z/OS uses 64 Bit Addressing and Even the Programs are compiled with AMode=24/31 these Loads will make use of 64 Bit Address.

This means the On Z/OS even AMODE=24 Program Calls
31 Program will not abend ?? Is it right or wrong..


Niranjan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Jun 07, 2004 5:04 am    Post subject: Reply with quote

Reddy niranjan,

Please search before posting. Check the following links which will answer your questions.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1142&highlight=amode

http://www.mvsforums.com/helpboards/viewtopic.php?t=543&highlight=amode

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
reddy_niranjan
Beginner


Joined: 07 Jun 2004
Posts: 3
Topics: 1

PostPosted: Mon Jun 07, 2004 7:07 am    Post subject: Thanks for response Reply with quote

kolusu,
Thanks for your fast response.This given links given me good idia about 24 Bit & 31 Bit addressing. But i have these doubts.Please respond..
1)These above given links are not given any direct solution to my problem. But i understood that even in Z/OS, it will abend when 24 Bit Program calls 31 bit program.Am i right?

2)Also i have a doubt that whether there is Compiler for 64 Bit. As per my understanding there is no compiler available for 64 Bit & 31 Bit Load Modules can use the facilities of 64 Bit...


Niranjan
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Jun 07, 2004 9:07 am    Post subject: Reply with quote

Niranjan,


1.Not exactly true.You can call a 31 bit program from a 24 bit program without any problem.

2. Though COBOL does not support 64-bit addresses in COBOL programs, the BINDER already supports 64-bit assembler programs and will support 64-bit C/C++ programs in the future.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Mon Jun 07, 2004 9:23 am    Post subject: Reply with quote

Kolusu,

If you dynamically call a 24 bit subroutine from a program that resides above the line (in 31 bit land), there may be a problem on the return as the return address will exceed the maximum value that a 24 bit address can hold. Is this not true?

There may also be problems if you call it with a "using" phrase and the variable is also above the line.

Incidentally, this problem also applies to 31 bit subroutines being called by programs that reside above the bar (64 bit land)
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Jun 07, 2004 9:51 am    Post subject: Reply with quote

Bithead,

You are right about the problem when calling a 24 bit subroutine from a program that resides above the line.

Examples of this are ILBOWAT0, [/b]IDCAMS[/b]. When you are calling these programs 2the main program which is calling these modules needs to be compiled with CBL DATA(24)

Niranjan's question was the reverse, he wanted to know if he can a 31 bit program from a 24 bit program

KOlusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Mon Jun 07, 2004 10:04 am    Post subject: Reply with quote

Then isn't the problem reversed? If you dynamically call a 31 bit program that is residing above the line from a program with 24 bit addressing, then you will get an S0C4.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Jun 07, 2004 2:33 pm    Post subject: Reply with quote

Bithead,

I just ran a test. The main program was compiled with data(24) and was link edited with Amode(24) and Rmode(24).

The subprogram is compiled with DATA(31) and Amode(31).

I ran the main program calling the sub-program dynamically and the job ran successfully giving me the desired results.

Let me know if you have any questions

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Jun 08, 2004 12:03 am    Post subject: Reply with quote

Did they reside in the same load module? If so, the code will all be <16M. Unless the compler does mode switching (BSM, etc), or uses SVC 6 or similar (LINK, etc), calling an AMODE31 pgm from an AMODE 24 will usually abend. That is, unless by chance the AMODE31 program gets loaded <16M (which is not unusual, but should never be assumed). Something has to switch the bit in the PSW or you will get into trouble.

As for 64 bit, any program can change its addressing mode, but it must do so explicitly. At this point, 64bit addressing is pretty much reserved for system routines.
Back to top
View user's profile Send private message Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Jun 08, 2004 7:53 am    Post subject: Reply with quote

Semigeezer,

They are not in the same load module. The main program is with AMODE(24) and RMODE(24) and the subprogram is AMODE(31) and RMODE(any). This is how the load module looks like

Code:
                   
             TXXXXXX.TEST.LOADLIB                         Row    00001 of 00002
===>                                                        Scroll ===> CSR
 Name        Prompt           Alias-of     Size       TTR     AC    AM  RM
COBSQRT                                  00001340   000010   00    31  ANY
MAIN                                     000012D0   000003   00    24   24


The MAIN program calls the COBSQRT program dynamically.

KOlusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Wed Jun 09, 2004 10:58 am    Post subject: Reply with quote

Kolusu,

I created a program called TRASH3 which I compiled with DATA(24) and linked with AMODE(24),RMODE(24).

I then created a program called TRASH2 which was compiled with data(31) and linked AMODE(31),RMODE(ANY). It dynamically called TRASH3 with a 10 byte data area.

I got the following error:

IGZ0033S An attempt was made to pass a parameter address above 16 megabytes to AMODE(24) program TRASH3.
From compile unit TRASH2 at entry point TRASH2 at compile unit offset +00000442 at address 0B20115A.

I changed both programs to removed the pass-area and compiled / linked them the same way. This time it worked fine.
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Jun 09, 2004 6:04 pm    Post subject: Reply with quote

As mentioned, something has to change the addressing mode of the system (hardware) for such calls to work. In Kolusu's case, it sounds like an SVC 6 was called (LINK). Data passed from a 24 to 31 bit pgm will be below the line so it will work. Not so the other way around. The reason return logic works in your 2nd case is that the LINK is doing the mode switching. That is to say, your program calls the link code via SVC 6 which sets up a save area and return address below the line and then calls TRASH3. TRASH3 runs and returns in 24bit mode to the system which then simply switches modes, propagates the return code to its save area and returns to your TRASH2 program.

Even if you just do a LOAD and branch from a 31 bit pgm to a 24 bit one, it *might* work, as long as no registers used for addressing contain non-zero values in the first byte. But the reason that programs usually have to run in 24 bit mode is precisely because they use that byte for something else. The old I/O routines (DCBs not DCBEs) are the usual reason for such things.
Back to top
View user's profile Send private message Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Jun 10, 2004 8:14 am    Post subject: Reply with quote

Bithead,

I am using Enterprise COBOL for z/OS and OS/390 3.2.0. can you run the following JCL and see if it runs successfully?

Code:

//STEP0100 EXEC PGM=IGYCRCTL                           
//STEPLIB  DD DSN=SYS1.SIGYCOMP,                       
//            DISP=SHR                                 
//SYSPRINT DD SYSOUT=*                                 
//SYSTERM  DD SYSOUT=*                                 
//SYSUT1   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)       
//SYSUT2   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)       
//SYSUT3   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)       
//SYSUT4   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)       
//SYSUT5   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)       
//SYSUT6   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)       
//SYSUT7   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)       
//SYSLIN   DD DSN=&&LOADSET1,                         
//            DISP=(MOD,PASS),                         
//            UNIT=DISK,                               
//            SPACE=(CYL,(1,1),RLSE)                   
//SYSIN    DD *                                                 
        CBL DATA(24)                                             
        IDENTIFICATION DIVISION.                                 
        PROGRAM-ID.    MAIN.                                     
        ENVIRONMENT DIVISION.                                   
        DATA DIVISION.                                           
        WORKING-STORAGE SECTION.                                 
                                                                 
        01  W-INPUT-FUNCTION.                                   
            05 W-FUNCTION           PIC X(02).                   
                                                                 
        01  W-INPUT-VAR.                                         
            05 W-NUM1               PIC S9(12)V9(5) COMP-3.     
            05 W-NUM2               PIC S9(12)V9(5) COMP-3.     
                                                                 
        01  W-OUTPUT-VAR.                                       
            05 W-OUTPUT             PIC S9(12)V9(5) COMP-3.     
                                                                 
        01  W-PGM                   PIC X(08) VALUE 'COBSQRT'.   
                                                                 
        PROCEDURE DIVISION.                                     
                                                                 
                                                                 
             MOVE '01' TO W-FUNCTION                             
             MOVE 10   TO W-NUM1                                 
             MOVE 02   TO W-NUM2                                 
                                                                 
             CALL W-PGM     USING W-FUNCTION                     
                                  W-INPUT-VAR                   
                                  W-OUTPUT-VAR                   
                                                                 
             DISPLAY 'THE OUTPUT VARIBLE:' W-OUTPUT             
                                                                 
             GOBACK.                                             
                                                                 
//*
//STEP0200 EXEC PGM=IEWL,                                       
//             PARM=('LIST,LET,XREF,DCBS,AMODE(24),RMODE(24)'),
//             COND=(5,LT,STEP0100)                             
//SYSLIB   DD DSN=SYS1.SCEELKED,                               
//            DISP=SHR                                         
//SYSLIN   DD DSN=*.STEP0100.SYSLIN,DISP=(OLD,DELETE)           
//SYSLOUT  DD SYSOUT=*                                         
//SYSPRINT DD SYSOUT=*                                         
//SYSDBOUT DD SYSOUT=*                                         
//SYSUDUMP DD SYSOUT=*                                         
//SYSLMOD  DD DSN=USERID.TEST.LOADLIB(MAIN),                   
//            DISP=(NEW,CATLG,DELETE),                         
//            UNIT=DISK,SPACE=(CYL,(5,2,1))                     
//*                                                             
//STEP0300 EXEC PGM=IGYCRCTL                           
//STEPLIB  DD DSN=SYS1.SIGYCOMP,                       
//            DISP=SHR                                 
//SYSPRINT DD SYSOUT=*                                 
//SYSTERM  DD SYSOUT=*                                 
//SYSUT1   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)         
//SYSUT2   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)         
//SYSUT3   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)         
//SYSUT4   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)         
//SYSUT5   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)         
//SYSUT6   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)         
//SYSUT7   DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)         
//SYSLIN   DD DSN=&&LOADSET2,                           
//            DISP=(MOD,PASS),                         
//            UNIT=DISK,                               
//            SPACE=(CYL,(1,1),RLSE)                           
//SYSIN    DD  *                                               
        CBL DATA(31)                                           
        IDENTIFICATION DIVISION.                               
        PROGRAM-ID.    COBSQRT                                 
        ENVIRONMENT DIVISION.                                 
        DATA DIVISION.                                         
                                                               
        LINKAGE SECTION.                                       
        01  L-INPUT-FUNCTION.                                 
            05 L-FUNCTION            PIC X(02).               
                                                               
        01  L-INPUT-VAR.                                       
            05  L-NUM1               PIC S9(12)V9(5) COMP-3.   
            05  L-NUM2               PIC S9(12)V9(5) COMP-3.   
        01  L-OUTPUT-VAR.                                     
            05  L-OUTPUT             PIC S9(12)V9(5) COMP-3.   
                                                               
        PROCEDURE DIVISION USING L-INPUT-FUNCTION,             
                                 L-INPUT-VAR,                 
                                 L-OUTPUT-VAR.                 
                                                               
                                                               
             IF L-FUNCTION = '01'                             
                COMPUTE L-OUTPUT = L-NUM1 ** L-NUM2           
             END-IF                                           
                                                               
             IF L-FUNCTION = '02'                             
                COMPUTE L-OUTPUT  = FUNCTION SQRT(L-NUM1)     
             END-IF                                           
                                                               
             GOBACK.                                           
                                                               
//*
//STEP0400 EXEC PGM=IEWL,                                         
//             PARM=('LIST,LET,XREF,DCBS,AMODE(31),RMODE(ANY)'),   
//             COND=(5,LT,STEP0300)                               
//SYSLIB   DD DSN=SYS1.SCEELKED,                                   
//            DISP=SHR                                             
//SYSLIN   DD DSN=*.STEP0300.SYSLIN,DISP=(OLD,DELETE)             
//SYSLOUT  DD SYSOUT=*                                             
//SYSPRINT DD SYSOUT=*                                             
//SYSDBOUT DD SYSOUT=*                                             
//SYSUDUMP DD SYSOUT=*                                             
//SYSLMOD  DD DSN=USERID.TEST.LOADLIB(COBSQRT),                   
//            DISP=SHR                                             
//*
//STEP0500 EXEC PGM=MAIN                   
//STEPLIB  DD  DSN=USERID.TEST.LOADLIB,   
//             DISP=SHR                     
//SYSPRINT  DD SYSOUT=*
//SYSOUT    DD SYSOUT=*


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Thu Jun 10, 2004 2:58 pm    Post subject: Reply with quote

OK, this is freaky - it worked!

THE OUTPUT VARIBLE:00000000010000000

I will need to look into this further.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Jun 10, 2004 3:43 pm    Post subject: Reply with quote

Bithead,

Thanks for running the test. I was totally confused as to how it worked. What is your version of cobol and operating system?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group