Linkgage between COBOL and HLASM (Assembly) with more than 32Kbytes

429 views Asked by At

I need to implement an Assembly module to read any file informed in JCL (F, FB, V, VB). This module is called inside my COBOL program. I already managed to implement the Open, Read and Close feature.

The Linkage is something like:

01 LNK-MOD.    
   05 LNK-MOD-OPTION PIC X(01)     VALUE SPACE.     
   05 LNK-MOD-STATUS PIC X(01)     VALUE SPACE.   
   05 LNK-MOD-LINE   PIC X(32676)  VALUE SPACES.

The module is called as folow:

CALL MOD01 USING LNK-MOD.

Does anyone else have some example of linkage usage for COBOL <<--->> Assembly?

PS. The module must be Assembly because I don`t have the file size (LRECL) in execution time.

Thanks in advance.

1

There are 1 answers

1
cschneid On BEST ANSWER

Of possible interest are the Language Environment (LE) Assembler Considerations. Since you are being called from COBOL, you are running in an LE enclave.

There is no limitation on the amount of data you can pass to your Assembler routine from your COBOL program, other than the limits the COBOL compiler puts on the size of Working-Storage (or Local-Storage, if you're using that).

The CALL you show in your question should work just fine as it is coded, except you need single quotes around the module name.

CALL 'MOD01' USING LNK-MOD.

Perhaps you have a problem addressing 32K of storage because a base register only lets you address 4K. You may only need to address the first 4K. The GET and PUT macros only need the address of the data area.

If for some reason you need to address the entire 32K area, you must assign a base register for each 4K block. That's a lot of registers to give up. I suggest not doing that unless it's absolutely necessary.

You might want to look into using C runtime routines fopen, fread, fwrite, fclose instead of using your Assembler routine. The C runtime routines are directly callable from your COBOL program, this is a capability Language Environment provides.

If you're having trouble linking your COBOL program and your Assembler program, you need to INCLUDE your Assembler module at link time.

INCLUDE ddname(MOD01)

In this example ddname must be defined in the link step JCL and its DSN must be a PDS or PDSE containing MOD01.

Some years ago, IBM changed what they call PGM=IEWL in JCL. It used to be called the linkage editor. They now call it the binder. This is sometimes confusing. The JCL remains the same. I am an old man, so I still call it the linkage editor, or the linker. I also sometimes say "control cards" instead of "control statements" even though I haven't used punched cards since the mid-1980s.