Submit COBOL Questions to Computer Education Techniques - CETi

Submit COBOL Questions to Computer Education Techniques - CETi

Submit COBOL Questions


Submit COBOL Questions

Technology Update

Knowledge Base

Submit COBOL Questions to Computer Education Techniques CETi Advanced search

Interrelated Information Technology

Programming Skills Questions

Utilities and Development Tools Questions

The Computer Education Techniques knowledge base is a service for answering questions, inclusive of the research and validation of the accuracy of information in the public domain. Citation of source documentation and examples are used to provide answers to the questions. Utilization of the information of this service and reliance on the answers, information or other materials received through this web site is done at your own risk. 

Q One of my peers asked if there was a way to get the “˘” to print on a COBOL report. My understanding is that the ˘ was used with EBCDIC, but is not used in ASCII. Is that correct? 
A In EBCDIC and COBOL, the character X'4A' can be used to print a cent symbol.

This COBOL snippet should meet your requirements:


Q How is a JCL return code set from a COBOL program?
A Move a value to the RETURN-CODE register. RETURN-CODE should not be declared in a program; it is a special register.

A These are compiler options that check subscript out of range checking at execution time. NOSSRANGE is the default and if chosen, no run time error will be flagged if an index or subscript goes out of the permissible range.

Q When an INITIALZE is performed on a group-field that it is part of the FD and input file and then a READ is performed, will there be 0 (zero) and spaces where there previously had been information?

FD input-file      
01 input rec.
   05 more-data    XX.
     INITIALIZE input-rec.
     READ input-file
     AT END    …….
         IF more-data = to ‘Y’
         MOVE ‘Y’ TO do-something-special
A Yes, your assumptions and logic are correct.

In a COBOL INITIALIZE statement, elementary FILLER items are ignored. This means that INITIALIZE does not impact and modify the values in the FILLER. Elementary FILLER are FILLER items with a Picture clause.  

In the example, the INITIALIZE statement probably is not needed since the READ statement will initialize the input record.

Q We occasionally receive COBOL error messages that start with IGY. However, we have not been able to locate a manual with a list of IGY messages.
A COBOL compiler error message are not documented in any manual. They are considered to be self explanatory. However it is possible to generate a complete listing of compiler diagnostic messages, with explanations, by compiling a program with a program name of ERRMSG specified in the PROGRAM-ID paragraph:

Q What COBOL support is offered with DB2 for z/OS, Version 8?
A DB2 Version 8 is delivering a precompiler which is very similar to the precompiler from Version 7. This was done by design in order to facilitate migration. Our strong recommendation is to use the version V8 precompiler. DB2 generates COBOL code that in certain situations will fail on the old compilers. Programs that use the V8 precompiler or coprocessor require Enterprise COBOL V3.4 for full support.

Q Why is my COBOL program listing not displayed in the Source window?
A When using Debug Tool, if a compile is performed with the TEST(NONE,SYM,SEPARATE) option, debugging data is stored in the data set pointed to by the //SYSDEBUG DD statement, which typically will be a PDS: partitioned data set. The identical location information is stored in the load module; therefore when a debugging session is started, the Debug Tool will be able to find the debugging information.

If SYSDEBUG data is moved, then one of the following actions needs to be performed in order to provide Debug Tool with the location of the debugging data:

  • Specify an EQADEBUG DD statement in the first list item of your startup job control language (JCL) to point to the new location.
    • This can be a concatenation of both SYSDEBUG COBOL debugging information and Assembler EQALANGX data.
    • The EQADEBUG DD name became available with Debug Tool Version 4.1 and provides the capability to specify a new location for the SYSDEBUG and/or EQALANGX debugging data sets.
  • When Debug Tool is started, push PF4 to get to the Source Identification Panel, overtype the wrong Listing/Source File location.
    • This will issue a SET SOURCE ON command and specify the name of the PDS that contains the debugging data.
  • When Debug Tool is started, enter the PANEL PROFILE command and specify the Default Listing PDS name.
    • This runs the SET DEFAULT LISTING command using the fully qualified PDS name.
  • When Debug Tool is started, issue the SET DEFAULT LISTING command and specify the name of the PDS that contains the debugging data.

Q Why is ABEND ASRA ABEND 0C4 occurring when a COBOL main program calls an Assembler subprogram in CICS?
A A COBOL main routine statically calls an ASSEMBLER subroutine that is not reentrant; it is coded to store into its save area that is contained in the load module). This problem only happens under CICS.

CICS requires re-entrancy.

Make a dynamic call from the COBOL to the ASSEMBLER sub and assemble and link the ASSEMBLER code as NORENT in order to place it into CICS transaction storage.

The assembler routine that is failing with the abendASRA is linked in with the Enterprise COBOL for zOS code as it is a static call. The load module is linked RENT. The ASSEMBLER is not RENT code as it has setup a DC for its save area. The failure occurs as soon as the ASSEMBLER routine tries to store into this load module-contained save area because, being rent, it is loaded in CICS protected storage (RDSA).

There 4 options for getting around this problem:

1. The best way is to recode the assembler program to be reentrant. The logic will have to be changed in order that it is no longer self-modifying (GETMAIN+s). It is not enough to just assemble with the RENT option.
2. Change the call to the ASSEMBLER routine to a dynamic call and then link the ASSEMBLER routine as NORENT. This will cause the ASSEMBLER load module to be loaded in TRANSACTION STORAGE, and it will not be shared among users. There will then be no problem in writing to the save area.
3. Do CICS LOADs and RELEASEs of the program. This would result in multiple copies being loaded and is not recommended. The management of these LOADs and RELEASEs is difficult.
4. Change the SIT parm RENTPGM from RENTPGM=PROTECT to RENTPGM=NOPROTECT This is not recommended as there will be only one copy of this load module loaded and many users using this one copy. This can result in the ASSEMBLER routine being called by one user who stores into the savearea's regs, goes into a wait, and another user storing into the savearea, overlaying the waiting user's values. When the first user finishes, the regs that are reloaded are corrupted.

Q Is there a way to address the limitation of 100 character parm length for parms passed to the Enterprise COBOL compiler?
A This parm length limitation of 100 is a JES limit, not a COBOL compiler limit. In order to not have to code CBL statements in source programs, the CBL statements will need to be placed in the JCL, not in the program source.








There are two DD's for SYSIN. The first one, is DD * and contains two CBL statements; it concatenated with the second one, which is the DD for the source code. With this method, any CBL statements contained in the JCL's SYSIN will be picked up for the compile, plus any PARM= on the EXEC statement.

A In the newer versions of Enterprise COBOL, more than 100 characters can be specified on the PARM parameter for the compile EXEC statement by providing the option inline using a PARM and an options DD statement.

Q In a COBOL program, how can a conversion be performed from EBCDIC to ASCII or ASCII to EBCDIC?
A This code can be utilized to perform the conversion.

01 WS-AREA    PIC N(50).
01 WS-CCSID   PIC 9(5).
01 WS-ASCII   PIC X(50).
01 WS-EBCDIC  PIC X(50).

     MOVE 819 TO WS-CCSID.
     DISPLAY "Now let's convert that WS-ASCII back to EBCDIC".
     MOVE 1140 TO WS-CCSID.
     STOP RUN.

Q I learned and used the COBOL programming language on a MVS ESA operating system in the late 1980’s, I have now been assigned to make assignments and retrofit this COBOL code to both client-server and web enablement API’s. Have there been many changes to COBOL and what do I need to learn?
A There are many new object oriented features in IBM COBOL compiler. A list of the most important new features include:
  • Classes can be defined; and both methods and data can be implemented in COBOL.
  • Object instances of Java or COBOL classes can be created.
  • Methods can be invoked on Java or COBOL objects.
  • Classes can be written which can be inherited from Java classes or other COBOL classes.
  • Overloaded methods can be defined and invoked.

Q What sequence of courses will provide me with mastery of the COBOL Programming language?

We offer two sequences for teaching COBOL:

  1. COBOL Programming and z/OS COBOL Application Development.
  2. COBOL application development on COBOL.NET and NetExpress

We also have a COBOL course for Java Programmers; this course is for experienced information technology personnel with a strong foundation with the Java programming language.

Q Is the COBOL programming language still important and should I learn it?
A It is common knowledge that the high growth areas of application development in IT are Java and .NET. However, the demand for COBOL programmers reflects an interesting imbalance in the IT field. Over the past 40 years, there has been a huge investment in the COBOL programming language and the colleges and IT graduate schools either offer minimal instruction or have no courses on the COBOL programming language and their curriculum do not teach advanced topics or third party utilities. Since they can’t recruit COBOL programmers out of school, a significant number of Fortune 1000 companies, government municipalities, and health-care facilities have been using SYS-ED to “Grow their own COBOL Programmers” for them. We offer intensive courses 5 days or less in duration which can be mixed and matched into 2- and 3-week programs and a comprehensive 6-week COBOL training program. Our staff has extensive development experience across the complete range of proprietary COBOL development platforms - IBM, Unisys, Micro Focus, Fujitsu, and CA-Realia. Duration for these COBOL platform-specific courses varies based upon whether the IT personnel to be trained is learning COBOL or learning how to code, edit, compile, and debug on a new platform or workbench. Both the COBOL courses offered through the SYS-ED schedule and our private courses reflect flexible scheduling options: evenings, weekends, and non consecutive weeks.

FYI, a similar situation exists with all the old line mainframe programming languages: Assembler, PL/1, and FORTRAN. SYS-ED has an extensive courseware library and 1000’s of programming examples and teach integrated curriculum for all of the legacy programming languages - basic, advanced, and debugging.

Q I have been reading about XML: Extensible Markup Language and how it is being implemented in a big way. Does COBOL support XML?
A Yes, COBOL supports XML; but only the newer versions of COBOL. Enterprise COBOL includes a high-speed parser that enables COBOL programs to process XML documents and populate COBOL data structures with the content of XML documents. If you are experienced with the COBOL language and require a sound foundation with XML and the new web enablement capabilities of COBOL, depending on your organization’s environment our recommendation would be either IBM Enterprise COBOL for z/OS and COBOL Programming courses. These courses are not intended for the programmer who want to learn COBOL; they are for experienced programmers who need to either develop or retrofit COBOL to the next generation of Internet programming.

Q My company, has several large DB2 databases. Are there new features in COBOL to process DB2 SQL requests?
A Enterprise COBOL supports the DB2 coprocessor. When the DB2 coprocessor is used, the compiler handles the source program(s) containing embedded SQL statements without the need to use a separate precompile step. In order to use this feature, your shop will need to have DB2 version 7 or later installed.

Q What tools are available to debug COBOL programs?
A Three tools are used for debugging COBOL programs:

From a practical standpoint dump reading is a lost art and is only occasionally required. SYS-ED teaches all three COBOL debugging tools and yes we can still teach COBOL dump reading.

Q My company is a 100% Microsoft Windows platform. Is there a COBOL compiler that I can use in the Windows platform?
A There are three products which can be used to develop programs for the Microsoft Windows platform:
  • Net Express - Micro Focus
  • Fujitsu COBOL