New Video: Introduction to VSAM for Assembler Programmers

Here is a shoutout to Ravi Cheepa for suggesting I needed to add some VSAM material to the site. I’ll start with this video that contains some basic information about VSAM and its macros: ACB, RPL, EXLST, PUT, GET, MODCB, …

I’ve always thought that looking at code is the best way for programmers to learn, so I’ll follow this up with a series of demo programs that do something interesting and efficiently. I’ll also add some video to explain the programs and why the techniques they use are efficient. More soon …

4 Comments

Filed under IBM Mainframe Assembler

New Video: External DSECTS – Q-cons, CXDs, and DXDs

Q-cons, CXDs, and DXDs enlist the help of the Binder to make it easy for you to allocate storage dynamically for all your CSECTS. They also widen the possibilities for how you can design multi-CSECT programs. Some companies use these ideas to promote the separation of storage and code. In any case, this is an interesting HLASM path to explore.

I’ve created a video to explain these ideas and a sample program listed below that you can use as skeleton code for further exploration.

        PRINT  ON,NODATA,NOGEN
**********************************************************************
**********************  STORAGE FOR ASECT ****************************
**********************************************************************
ASTOR    DSECT
A1       DS    CL80       SOME VARIABLES FOR ASECT
A2       DS    CL30
A3       DS    CL5
A4       DS    PL10
A5       DS    200CL5
SAVEA    DS    18F        AREA FOR MY CALLEE TO SAVE & RESTORE MY REGS
**********************************************************************
**********************  STORAGE FOR PARMS ****************************
**********************************************************************
PARMSECT DSECT
X        DS    CL80
Y        DS    CL80
Z        DS    CL80
**********************************************************************
**********************  ASECT CONTROL SECTION ***********************
**********************************************************************
ASECT   CSECT
ASECT   AMODE  31
ASECT   RMODE  24
**********************  ENTRY LOGIC  *********************************
         STM   14,12,12(R13)          SAVE CALLER'S REGS
         BASR  R12,0                  ESTABLISH
         USING *,R12                  ADDRESSABILITY
         L     R8,EDSLEN              GRAB LENGTH OF STORAGE NEEDED
         STORAGE OBTAIN,LENGTH=(R8),ADDR=(R11)
         LR    R10,R11                GRAB ADDRESS FOR ALL STORAGE
         A     R10,ASECTO             ADD OFFSET FOR MY DSECT
         USING ASTOR,R10              I HAVE ADDRESSABILITY
         ST    R13,SAVEA+4            BACK-CHAIN CALLER'S FROM MINE
         LA    R13,SAVEA              POINT TO MY LOWER-LEVEL SA
**********************  BEGIN LOGIC  *********************************
         OPEN  (FILEOUT,(OUTPUT))
         PUT   FILEOUT,=CL80'ENTERING PROGASECT'
         LR    R9,R11                  POINT AT DYNAMIC STORAGE
         A     R9,PARMO                ADD THE OFFSET FOR PARMS
         USING PARMSECT,R9             I HAVE ADDRESSABILITY
         MVC   X,=CL80'THIS IS PARM X' INITIALIZE ...
         MVC   Y,=CL80'THIS IS PARM Y' ... PARMS
         MVC   Z,=CL80'THIS IS PARM Z'
         LA    R1,=A(FILEOUT,PARMO)   PASS THE DCB AND PARMO
         L     R15,=A(BSECT)          CALLING BSECT
         BASR  R14,R15                BRANCH THERE
         PUT   FILEOUT,=CL80'RETURNED TO PROGA1'
         LR    R9,R11                 POINT AT ALLOCATED STORAGE
         A     R9,XXXAO               ADD THE OFFSET TO XXX
         PUT   FILEOUT,0(R9)          R9 POINTS AT XXX
         CLOSE FILEOUT
         STORAGE RELEASE,LENGTH=(R8),ADDR=(R11)
*********************** STARDARD EXIT ********************************
RETURN   EQU   *                      BRANCH TO HERE FOR NORMAL RETURN
         L     R13,SAVEA+4            POINT TO CALLER'S SAVE AREA
         LM    R14,R12,12(R13)        RESTORE CALLER'S REGS
         LA    R15,0                  SET RETURN CODE REG 15 = 0
         BR    R14
****************** LOCAL DATA AREAS   ********************************
FILEOUT  DCB   DSORG=PS,                                               X
               MACRF=(PM),                                             X
               DEVD=DA,                                                X
               DDNAME=FILEOUT,                                         X
               RECFM=FB,                                               X
               LRECL=80
ASECTO   DC    Q(ASTOR)               OFFSET TO ASTOR
PARMO    DC    Q(PARMSECT)            OFFSET TO PARMSECT
XXX      DXD   CL80                   DECLARATION OF XXX IN EDS
XXXAO    DC    Q(XXX)                 OFFSET TO XXX
EDSLEN   CXD                          FULLWORD TOTAL SPACE NEEDED
         LTORG
         YREGS

**********************************************************************
**********************  STORAGE FOR BSECT ****************************
**********************************************************************
BSTOR    DSECT
B1       DS     F           THE STORAGE AREAS NEEDED IN BSECT
B2       DS     CL20
B3       DS     PL5
B4       DS     CL100
B5       DS     CL5
SAVEB    DS   18F                     BSECT SAVE AREA
**********************************************************************
**********************  BSECT CONTROL SECTION ***********************
**********************************************************************
BSECT    CSECT
         STM   14,12,12(R13)          SAVE CALLER'S REGS
         BASR  R12,0                  ESTABLISH
         USING *,R12                  ADDRESSABILITY
         LR     R10,R11               SET UP...
         A      R10,BSECTO            ... ADDRESSABILITY FOR BSECT
         USING  BSTOR,R10             I HAVE STORAGE ADDRESSABILITY
         LR     R9,R11                POINT AT ALLOCATED MEMORY
         L      R6,4(R0,R1)           R6 POINTS AT PARMO
         A      R9,0(R0,R6)           ADD THE OFFSET FOR PARMS
         USING  PARMSECT,R9           I HAVE PARM ADDRESSABILITY
         ST     R13,SAVEB+4
         LA     R13,SAVEB
**********************  BEGIN LOGIC  *********************************
         L      R5,0(R0,R1)           R5 POINTS AT MY RECOUT DCB
         PUT    (R5),=CL80'ENTERED BSECT'
         PUT    (R5),X                PRINT THE PARMS
         PUT    (R5),Y
         PUT    (R5),Z
*
*        USE BSTOR FIELDS CAN BE USED HERE
*
         MVC    B4,=CL80'THIS IS B4 DATA'
         PUT    (R5),B4
*
*        PREPARE TO USE XXX
*
         LR     R9,R11                POINT AT XDS WITH R9
         A      R9,XXXBO              ADD THE OFFSET TO XXX
         MVC    0(80,R9),=CL80'XXX IN ASECT WAS CHANGED IN BSECT'
*
         PUT    (R5),=CL80'ABOUT TO LEAVE BSECT'
*********************** STARDARD EXIT ********************************
         L      R13,SAVEB+4           STANDARD EXIT CODE
         LM     R14,R12,12(R13)
         BR     R14
************* INITIALIZED DATA AREAS AND PARMS ***********************
BSECTO   DS     Q(BSTOR)      OFFSET FOR BSECT STORAGE
XXXBO    DC     Q(XXX)        OFFSET TO XXX
         LTORG
         END   ASECT

Leave a comment

Filed under IBM Mainframe Assembler

New Video: Using COM Control Sections

I’ve recently added a video that covers COM control sections – an old idea that’s interesting to try. If your program consists of multiple CSECTs, you can create a COM section – an uninitialized storage area that becomes part of the object module – and which can be shared selectively among the CSECTs that comprise the program. You can find the video here and some sample code to play with here. There’s also links to these items in the Video Course.

3 Comments

Filed under IBM Mainframe Assembler

Links Updated

I’ve updated the links to a few html pages that used Flash to reference mp4 files. If you have any trouble playing video from my site, send me the link and I’ll repair it.

1 Comment

Filed under IBM Mainframe Assembler

Updating the Site

Evidently, I have a number of pages on the site that invoke a Flash player that is no longer supported in most browsers. I am working to repair this problem as quickly as possible. I apologize for the inconvenience.

Leave a comment

Filed under IBM Mainframe Assembler

Last COBOL Fridays Webcast: tune in

It was fun and and flattering to be a part of the IBM-sponsored COBOL Fridays Webcast twice over the past year. If you missed them, you can still catch the webcasts here:

https://developer.ibm.com/languages/cobol/series/cobol-fridays-webinar-videos/

IBM and the Open Mainframe Project offers software, a COBOL course, and mainframe access to programmers wanting to learn COBOL. You can still be part of the fun for free – quite an opportunity.

I’m looking forward to being on the last webcast this Friday as part of a panel discussion that wraps up the series. Hope you can tune in. The Webcast starts at 10:30 EST here. Or you can catch the replay later at your leisure.

2 Comments

Filed under IBM Enterprise Cobol

Don’t Have Mainframe Access? Try This

If you want to learn IBM mainframe assembly language but don’t have access to an IBM System/z machine, there is an excellent alternative:  Z390 Portable Mainframe Assembler and Emulator. (Even if you do have access, you can find it helpful.) This product has a long, successful history, is freely distributed, and runs on Windows, Linux, and Mac PC’s. It also supports all the instructions described in the Principles of Operation manual of October, 2019 – very impressive!

I asked Don Higgins, the creator, to write a short article about his product. Here it is.

Z390 Portable Mainframe Assembler and Emulator Overview

Don Higgins

November 20, 2020

Z390 is an open-source, Java-based mainframe assembler and emulator designed to run on Windows, Linux, and Mac PC’s.  The predecessor to z390 was the PC/370 shareware mainframe assembler and emulator for MS-DOS PC’s.  PC/370 was used by thousands of students at universities in the 1980s.  In 1993 I sold PC/370 to Micro Focus, and in 1995 I went to work for Micro Focus developing the assembler component of the Micro Focus Mainframe Express product for Windows PCs.  In 2004 I left Micro Focus and started the z390 open source project. 

The original goal of z390 was to assemble, link, and execute problem state application programs on any platform that supports Java runtime.  Over the years, the following major features have been added to z390:

  1. Macro process and assembler compatible with HLASM
  2. Linker to create executable modules 
  3. Emulator with the following support:
    1. Problem state instruction execution
    1. Trace and dump options
    1. Floating-point, including HFP, BFP, and DFP.
    1. Storage management including GETMAIN and FREEMAIN
    1. QSAM, BDAM, and VSAM file management
    1. Sort merge utility
  4. zCOBOL compiler which generates z390 assembler
  5. zCICS transaction support developed by Melvyn Maltz
  6. Graphical User Interface

In 2012, I retired from z390 development for a while.  Abe Kornelis and Melvyn Maltz continued to develop z390.  In 2020 I returned and have spent most of 2020 upgrading the z390 assembler to correctly assemble all the IBM mainframe instructions in the Principles of Operation manual published in Oct. 2019.  A test program named ZOPCHECK was developed to verify all 2357 opcode, mnemonic, and operand combinations.

 References:

  1. Z390 Mainframe Assembler and Emulator Downloads
  2. Z390 Portable Mainframe Assembler and zCOBOL and zCICS
  3. Z390 Sort Utility
  4. ZOPCHECK Opcode Verification Program
  5. PC370 Assembler and Emulator History

Leave a comment

Filed under IBM Mainframe Assembler

z/OS Training at Marist College Enrolling Now

Marist College through the Institute of Data Center Professionals (IDCP) offers a variety of mainframe-based courses and professional z/OS certificates all online. Working jointly with IBM, these worldwide programs were designed to educate personnel who are entering the field as well as those with experience in z/OS and a variety of application programming tracks including COBOL, DB2 and Assembler language.

If you are looking for specialized mainframe training online, look no further.  Fall classes start August 31, 2020.  Here is the best link for the program:  https://conta.cc/30UErq3e

For a number of years I’ve taught the two-course assembler sequence for Marist to people located around the globe. The course evolves each year and I take pride in adding new topics and videos each time I teach it. I’d love to work with you individually to master IBM Assembly language in a small-group asynchronous online setting. Together, we will work through a sequence of on-target programming assignments. At the end, you’ll have the necessary skills to begin working as an assembler programmer.  But don’t wait, classes are starting soon.

 

Leave a comment

Filed under IBM DB2, IBM Enterprise Cobol, IBM Mainframe Assembler

Writing Reentrant Assembler Code

Some programs run so often we take special efforts to make sure that only one copy of the program needs to be loaded into memory, no matter how many users are running it concurrently. That’s what reentrant programming is all about. We can do this by dynamically allocating storage for all the parts of our program that might change. Each user gets their own copy of dynamic storage.

Want to get your assembler program to run in the Language Environment?  It needs to be reentrant.  Future posts will cover COBOL calling Assembler and Assembler calling COBOL in the Language Environment, but to follow along, you first have to learn how to  write assembler reentrantly.

Some programmers write all their programs in a reentrant style. There’s not a lot of extra overhead. Want to give it a try?  I’ve posted a video about how it works here and in the assembler video course. There’s also a sample reentrant program you can start with here.  The video explains in detail how the program works.

 

 

5 Comments

Filed under IBM Mainframe Assembler

Marist ECC Conference – Free Online June 7-9

Marist College sponsors one of my favorite mainframe conferences each year called the Enterprise Computing Conference. This year it is scheduled for June 7-9, and it is online and free. The conference always features some interesting general talks by leading IBM and industry experts, as well as a number of smaller talks on mainframe related topics. Here is your chance to attend for free. Check out the conference schedule here: https://ecc.marist.edu/web/conference2020/welcome

Be sure to register early so you won’t miss anything. I’m sorry I won’t get a chance to visit the lovely Marist campus on the Hudson river this year, but I’m looking forward to enjoying the conference virtually. See you there.

Leave a comment

Filed under IBM Mainframe Assembler

Datasets for the COBOL Course

I have added a tab (Course Datasets) at the top of the blog to help provide input data for the programs referenced in the COBOL course.

In the case of input files that contain packed data, I am including a COBOL program that will produce the input file when you run it. Each COBOL program takes its own data from an in-stream dataset. I’m including the COBOL code and the JCL surrounding it to make things easier. You will have to adjust the file names.

In the case textual data files, I’m including a copy of the input data which you can paste into a member in a PDS to create the input file.

Let me know if I can help.

1 Comment

Filed under IBM Mainframe Assembler

IBM’s COBOL FRIDAY WEBCAST

I had lots of fun this morning on IBM’s COBOL FRIDAY with Sudharsana Srinivasan and Paul Newton. I talked mostly about COBOL intrinsic functions, but we also considered what to do if you wanted to write something that sort of works like a user-defined function. Enterprise COBOL doesn’t support user-defined functions just yet, but it’s in the works. My work-around involves writing nested programs. You can watch the webcast here if you are interested. I also posted some sample code at the Enterprise COBOL tab that goes along with the talk. The STACKY program does dynamic allocation and creates a stack for storing pointers to records. It uses a nested programming style to create the data structure.

Leave a comment

Filed under IBM Mainframe Assembler

Learn You a COBOL for Great Good

The title is a reference to one of my favorite programming language instruction texts: Learn You a Haskell for Great Good. Funny, well-written and instructive. If you want to learn a functional language, Haskell is a fine choice. I still like writing in Scheme – another functional language that’s almost as old as Cobol.

But today’s topic is Cobol, which has been in the news lately, and which has a few programmers dusting off their old textbooks and manuals.  If you want to learn Cobol or brush up on your old Cobol skills, I might be able to help. I developed an online class a few years ago to use for corporate training. Now I’ve decided to publish it for general use.

You can find it here: IBM Enterprise Cobol and as a link at the top of the home page. It was built with the idea of taking a beginner and turning them into a corporate programmer. If you have some mainframe skills already, you can skip some of the beginning lessons.

The course is divided into 5 units, and if you push hard, it’s possible to get through a unit each day – a week of corporate training.  The course comes with an extensive collection of slides – 299 in all.  There are 15 programming problems that you will need to tackle and complete if you are really wanting to learn something.

You can help me by reporting any problems you have with the site or with the material.

So, … I hope this will help you learn a Cobol for great good!

7 Comments

Filed under IBM Enterprise Cobol, IBM Mainframe Assembler