Cobol Archive

COBOL date functions list, add find Duration

Below are COBOL date functions to add, Subtract and Find the duration between Dates, Times and Time stamps. 1. ADD-DURATION This is rarely seen in our programs but really a helpful Intrinsic function that COBOL provided. This is to add a specific duration to a date/time variable/value. For example if 1 year needs to be

COBOL Edited Picture Clause Examples

Edited Picture Clause in COBOL is to format the the display of data in required format. COBOL provides symbols to format the data, these are called “Edit Symbols” and the PIC clauses that contains these symbols are called as “Edited Picture clauses”. There are basically two types of Edited picture clauses based on their type

Initialization in Cobol

Initialization in COBOL is used to set the declared variable values to an initial value. It sets the Alphanumeric type(alphabetic, alphanumeric, alphanumeric-edited, DBCS, national, or national-edited) field values to Spaces and Numeric type(numeric or numeric-edited) field values to Zeroes. It is equivalent of moving eirther zeroes are spaces to the variables according to their data

Reference Modification With OF

COBOL Reference Modification With OF Syntax to use reference modification for a filed, which exists in multiple groups. Ex: [crayon-5c68725b2a1df970990290/] name1 exists in both groups. So if we want to use reference modification for ww-grp1 [crayon-5c68725b2a1e6506640434/] [crayon-5c68725b2a1e8462166569/] Above one will not work as it is not correct syntactically. Basic details of Ref. Modification: This is

Difference Between LINK/XCTL and COBOL Calls

Difference Between LINK XCTL and COBOL Calls(Static & Dynamic) 1. LINK –> Every time a subprogram is invoked an initialized version of working storage is provided. Dynamic& Static –> Not every time a separate copy of working storage is provided. It is provided only for the first time invocation of sub-program and for the subsequent

COBOL RANDOM Function Examples

COBOL RANDOM Function generates the random fractional values ranging from 0 to 1. It generates values like For example if we declared the variable as below 01 WW-RANDOM-NUMBERS PIC 99.999 VALUE ZEROES. PERFORM VARYING WW-SUB1 FROM 1 BY 1 UNTIL WW-SUB1 > 9 COMPUTE WW-RANDOM-NUMBERS = FUNCTION RANDOM DISPLAY ‘–>’WW-RANDOM-NUMBERS END-PERFORM Result: –>00.443 –>00.060


INSPECT verb in COBOL is very useful and it is used to do the following functionalities  Count a particular Character in a string  Convert Lower case to upper case  Replace a particular Character with other character in a string  Replace a set of characters with another set of characters Below are the different examples on

COBOL DB2 Multi Row Fetch

Multi row Fetch Overview in COBOl Db2 program WITH EXAMPLE: Cobol Db2 multi row fetch concept will be used to retrieve multiple rows with a single fetch statement as opposed with a normal cursor which fetches only single record at a time. The multi-row fetch capability was introduced to DB2 z/OS in Version 8. This

COBOL Index & Subscript

Index & Subscript – performance considerations Both are used to reference an array or table element in COBOL programs. By knowing the basic differences between the two, one can code the programs efficiently in performance point of view. 1. Index –> Represents the displacement of a table entry from its begining which is being set

COBOL Perform Types and Usage with examples

Perform Verb in COBOL is used to execute a set of COBOL statements. There exists different types of performs based on the way that is being used. It is vital in keeping a cobol program structured by making it possible to call different paragraphs or sections from another paragraph or section. Following are some of