it operations

  • COBOL Support

  • COBOL Syntax/Commands

  • COBOL Tutorials

  • COBOL Users Group

  • White Papers

  • COBOL XML Code Examples

     >Processing COBOL XML Documents
    Here are code samples of processing COBOL XML documents with iSeries COBOL.




  • COBOL Users Group

  • Database Code Examples

    >ADO.NET/ COBOL/Stored Procedures
    This COBOL sample provides an example of how to access a stored procedure to perform a specific task such as create a new table, retrieve data from one or more tables, update one or more tables or perform many other tasks. 

    >COBOL Procedures
    COBOL procedures are to be written in a similar manner as COBOL subprograms. This COBOL example describes handling parameters in a COBOL procedure and exiting a COBOL procedure.

    >DB2 Explain Command
    How to Explain a DB2 SQL Command for a single table. 

    >DB2/SQL/COBOL Samples
    Several IBM COBOL and MicroFocus COBOL samples that include COBOL DB2 API sample programs with no embedded SQL, COBOL DB2 API embedded SQL sample programs, and COBOL SQL sample programs with no DB2 APIs. 

    >DB2/SQL/COBOL for AS/400 Example
    The SQL COBOL example demonstrates how to code SQL statements using iSeries (AS400) COBOL. 

    >Sybase COBOL SQL Samples
    The COBOL sample programs demonstrate features such as how to code a batch of INSERT requests, how to code a DB2 Input Pipe, how to code a transfer request, how to code keyword input, how to embed SQL in COBOL programs, and more. 

    >Tips for Writing an INMOD in COBOL
    Here are tips for writing INMOD routines for Teradata FastLoad in COBOL


  • File Handling Code Examples

    >COBOL Coding for Files Example
    The general format of COBOL input-output coding is shown. 

    >COBOL File Status Code with Text Information
    This COBOL file status example will show how to convert the two byte file status code that may contain binary data to a four byte numeric value that may be displayed. 

    >COBOL File System and Programming
    Here are COBOL file system and programming source code examples. 

    >COBOL Record Format Examples
    COBOL sample code describing record description, determining fixed-length record size, determining fixed-length record size for files with multiple record descriptions, creating variable-length records with the DEPENDING ON Phrase, creating variable-length records with the RECORD VARYING Phrase, and creating variable-length records and using the OCCURS Clause with the DEPENDING ON Phrase. 

    >Comma delimited, QSAM, and COBOL VSAM Files
    Here are several COBOL data access sample programs that cover handling comma delimited, QSAM, and COBOL VSAM files. 

    >Displaying Record-Lock Messages
    This iSeries COBOL subroutine displays record-lock messages. 

    This COBOL program converts EBCDIC-sequential to ASCII-indexed. 

    >Line Sequential File Example
    This COBOL sample demonstrates line sequential file handling. 

    >Read an IFS File
    This is an iSeries Cobol example showing how to read lines from an IFS file. 

    >COBOL VSAM and QSAM COBOL File Status Keys/Error Codes
    This is a COBOL program example of how to determine the COBOL VSAM and QSAM COBOL file status keys/error codes in an IBM Enterprise COBOL environment. 

    >VSAM File Access for COBOL
    If you are interested in writing COBOL programs that utilize VSAM datasets, I hope this documentation has provided you with the information you need to install my routine and get started writing programs on your own.





  • COBOL Future Date Calculation

    Contributed by: Don Stafford, Director of Information Technologies, UAV Entertainment Corporation

    We needed a routine to calculate a date in the future, based on business days, not on calendar days. In searching the internet, no COBOL source could be found.
    However, several routines were found in various other programming languages.
    I took several of those and adapted the code to MicroFocus Cobol. In Working Storage, you need the following variables:       01 CalDays                         PIC 9(3).
          01 BusDays                        PIC 9(3).
          01 DelDay                          PIC 9(3).
          01 DelWks                         PIC 9(3).
          01 WS-DAY-OF-WEEK        PIC 9(2).
          01 DAYS-TO-ADD              PIC 9(3).
          01 DATE-YMD-IN               PIC 9(8).
          01 DATE-YMD-OUT            PIC 9(8).
          01 DATE-DAY                    PIC 9(8). In the Procedure Division, you have 2 paragraphs:       ADD-BUS-DAYS-TO-DATE.          PERFORM GET-DAY-OF-WEEK-FOR-DATE.
             IF WS-DAY-OF-WEEK = 6
                MOVE 5 TO WS-DAY-OF-WEEK
                SUBTRACT 1 FROM DAYS-TO-ADD.          MOVE DAYS-TO-ADD TO CalDays,
                                                            BusDays.          COMPUTE DelDay = WS-DAY-OF-WEEK + DAYS-TO-ADD.          IF DelDay > 5
                COMPUTE BusDays = BusDays - ( 6 - WS-DAY-OF-WEEK )
                COMPUTE CalDays = CalDays + 2
                COMPUTE DelWks = BusDays / 5
             COMPUTE DATE-YMD-OUT = FUNCTION DATE-OF-INTEGER (DATE-DAY). The current (base) date is moved into DATE-YMD-IN.
    The number of (business) days to add is moved into DAYS-TO-ADD.
    You then call  ADD-BUS-DAYS-TO-DATE.
    The resulting date is in DATE-YMD-OUT. Obvious note:  If you call ADD-DAYS-TO-DATE, it simply calculates a date in the future without regards to weekends.
    Not-so-obvious note:  If you make ADD-DAYS-TO-DATE a PIC S9(3), then ADD-DAYS-TO-DATE will add or subtract days.  The ADD-BUS-DAYS-TO-DATE only works with +(positive) numbers.
    Don Stafford, Director of Information Technologies
    UAV Entertainment Corporation
    2200 Carolina Place
    Fort Mill, SC  29708

This website uses cookies to manage authentication, navigation, and other functions. By using our website, you agree that we can place these types of cookies on your device.

View e-Privacy Directive Documents

You have declined cookies. This decision can be reversed.

You have allowed cookies to be placed on your computer. This decision can be reversed.


Member Login