Examples of assembler code.

This page contains the following sample programs:

Remark 1:
All samples on this page are no more than examples, and are in no way guaranteed to be free of errors or omissions. You may use (parts of) these code-samples, but it remains in all aspects your own responsibility to test your programs.

Remark 2:
All comments in the code samples are in english. Comments in your sources can of course be in any language you choose. We recommend that you use the language most commonly used in your firm. The same holds of course for all other kinds of documentation as well.


Static glue module.

In order to build a miniature DataBase Manager (DBMS) we employed the following premises:

View source code of program BXAIO .


Dynamic VSAM I/O module.

For a short description of the design please refer to the topic above: static glue module.

View source code of program BXAIO00.


Dummy program in amode 24.

This program issues a message to show that it was invoked correctly. The program runs in amode 24, and has no useful function. This program was written to test the GLUE macro and it can be used as a sample or skeleton program.

View source code of program BXALOWPG.


Overview of control blocks.

This program has no run-time function. It is used to generate overviews of fields in control blocks and to check that no conflicts are created in the naming of fields.

The control blocks to be generated can be selected by changing the value of the assembly-variabele &SELECT.

View source code of program BXAMAPS.


Check the value of a JCL-variable.

This program checks the value of a JCL-variable.

The check to be performed is to be supplied in the PARM-field of the EXEC-statement.
The syntax is as follows:

The program ends with a return code 0 (check evaluates as true) or 4 (check false). Other steps in the job can be executed or skipped depending upon these return codes.

The following example shows how program BXATEST can be used in a JCL proc:

//BXAASM   PROC MEMB=,PROJ=,LVL=
//*
//TEST     EXEC PGM=BXATEST,PARM='&LVL EQ T'
//PROD     EXEC PGM=BXATEST,PARM='&LVL EQ P'
//*
//* Invoke assembler, using default parms for TEST
//*
//         IF   (TEST.RC = 0) THEN
//ASMT     EXEC PGM=ASMA90,PARM=(OBJECT,NODECK,TERM,
//             'SYSPARM(SRLIST,DBG,OPT)')
//SYSLIB   DD   DSN=SYS1.MACLIB,DISP=SHR
//         DD   DSN=SYS1.MODGEN,DISP=SHR
//         DD   DSN=BIXOFT.ASMPLUS&LVL..MACLIB,DISP=SHR
//         DD   DSN=BIXOFT.ASMPLUSP.MACLIB,DISP=SHR
//         DD   DSN=BIXOFT.&PROJ.&LVL..MACLIB,DISP=SHR
//         DD   DSN=BIXOFT.&PROJ.P.MACLIB,DISP=SHR
//...      Other DD-statements
//         ENDIF
//*
//* Invoke assembler, using default parms for PROD
//*
//         IF   (PROD.RC = 0) THEN
//ASMP     EXEC PGM=ASMA90,PARM=(OBJECT,NODECK,TERM,
//             'SYSPARM(SRLIST,NODBG,OPT)')
//SYSLIB   DD   DSN=SYS1.MACLIB,DISP=SHR
//         DD   DSN=SYS1.MODGEN,DISP=SHR
//         DD   DSN=BIXOFT.ASMPLUS&LVL..MACLIB,DISP=SHR
//         DD   DSN=BIXOFT.&PROJ.&LVL..MACLIB,DISP=SHR
//...      Other DD-statements
//         ENDIF
//*
//         PEND

View source code of program BXATEST.


Copy a dataset or a member.

This program will copy a member from a PDS concatenation or a physical sequential dataset concatenation.

For MEMBER=memname the INPUT concatenation of PDS'es will be searched for the specified member, which will then be copied to OUTPUT.
For DATSET=PS the INPUT concatenation of physical sequential files will be copied to OUTPUT.

IEBCOPY does more, but needs control cards for its input, which cannot be substituted from JCL variables.
IEHLIST will also copy datasets, but it also lists all records, filling up the spool.

The following example shows how program BXACOPY can be used in a JCL proc:

//BXAASM   PROC MEMB=,PROJ=,LVL=
//*
//* Copy source member to be used
//*
//COPY     EXEC PGM=BXACOPY,PARM='MEMBER=&MEMB'
//INPUT    DD   DSN=BIXOFT.&PROJ.&LVL..ASM,DISP=SHR
//         DD   DSN=BIXOFT.&PROJ.P.ASM,DISP=SHR
//OUTPUT   DD   SPACE=(TRK,(10,10,1),RLSE),DISP=(NEW,PASS,DELETE),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920),
//             DSN=&&ASM(&MEMB)
//*
//...      other steps
//         PEND

View source code of program BXACOPY.


Unload a library.

This program unloads all members of a PDS into a single IEBUPDTE-job which can be used to reload the library anywhere else.
The program accepts a parameter, which specifies the step-name for the IEBUPDTE-job to be generated.

The advantage of using the IEBUPDTE format is that the source code can be browsed or edited under DOS, Windows and Unix as well.

The example below shows how BXAUNLD can be invoked.

//BXAUNLD  EXEC PGM=BXAUNLD,PARM='GOODIES'
//SYSUT1   DD   DSN=BIXOFT.GOODIES.ASM,DISP=OLD
//SYSUT2   DD   DSN=BIXOFT.GOODIES.UNLOAD,DISP=(NEW,CATLG,CATLG),
//             SPACE=(TRK,(10,10),RLSE),UNIT=3390,VOL=SER=TEMP00,
//             DCB=(LRECL=80,BLKSIZE=27920,RECFM=FB)

View source code of program BXAUNLD.


Remarks? Questions? More information? Select the topic of your choice or e-mail us with your questions.

 

Traditional Assembler examples:

Bixoft's eXtended Assembly examples:


 

This site is a member of WebRing.
You are invited to browse the list of mainframe-loving sites.
Running
    Tyrannosaurus Rex Dinos are not dead. They are alive and well and living in data centers all around you. They speak in tongues and work strange magics with computers. Beware the dino! And just in case you're waiting for the final demise of these dino's: remember that dinos ruled the world for 155-million years!
Dinos and other anachronisms
[ Join Now | Ring Hub | Random | << Prev | Next >> ]