Monthly Archives: September 2010

JOB Input statement in Easytrieve

Job statement is the main section or Procedure division of the easytrieve. Let us see the different types of JOB statements. JOB INPUT NULL If you want to process the files yourself and you dont want the Easytrieve to read/match files for you, please use JOB INPUT NULL. e.g, —-+—-1—-+—-2—-+—-3—-+—-4—-+—-5—-+—-6—-+—-7– LIST ON FILE INFILE FB(80 [...]

Easytrieve MACROs (Copybook)

Easytrieve MACROs are similar to COBOL Copybooks. i.e, they are used to reuse the layout of a file. A Sample Macro: MYDATA.SET.MACROS(MYFILE) MACRO INFILE IN-REC 1 80 A IN-KEY 1 8 A The first line of a Macro should be MACRO. How to use this in an Easytrieve program? —-+—-1—-+—-2—-+—-3—-+—-4—-+—-5—-+—-6—-+—-7– LIST ON FILE INFILE FB(80 [...]

Equivalent functionality for REDEFINES in Easytrieve

have you already read Easytrieve Variable declaration? In COBOL, REDEFINES verb can be used to declare variables that share a same memory location. In Easytrieve also, there is a similar functionality. For example, the ALPHA and NUMERIC variables given below share the same 5 bytes. WS-ALPHA W 5 A WS-NUMERIC WS-ALPHA 5 N Since the [...]

OCCURS Clause in Easytrieve

This post is a part of Easytrieve variable declaration. You can read it first. As in COBOL, OCCURS clause can be used to declare an Array in Easytrieve also. Below is a sample program. —-+—-1—-+—-2—-+—-3—-+—-4—-+—-5—-+—-6—-+—-7– LIST ON FILE INFILE WS-ALPHA W 26 A VALUE ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’ WS-ALP-ARR WS-ALPHA 1 A OCCURS 26 INDEX ALPHA-NDX * JOB [...]

FILE-STATUS and EOF (End of File) in Easytrieve

In Easytrieve, whenever you perform an operation to a File, the STATUS of the operation can be checked using the FILE-STATUS variable. For Normal Files, FILE-STATUS = 0 means, Successful GET or PUT or READ or WRITE operation. GET INFILE IF INFILE:FILE-STATUS NE 0 DISPLAY ‘ERROR IN READING FILE’ END-IF End of a File can [...]

Logical Operators in DB2

Functionality Operator Logical AND <condition 1> AND <condition 2> Logical OR <condition 1> OR <condition 2> Logical NOT NOT <condition> Greater than <value 1>  > <value 2> Less than <value 1>  < <value 2> Greater than or equal to <value 1>  >= <value 2> Less than or equal to <value 1>  <= <value 2> Not [...]

GET and PUT statements in Easytrieve

GET and PUT statements are used to Read and Write to/from a file. See a sample Easytrieve program below. —-+—-1—-+—-2—-+—-3—-+—-4—-+—-5—-+—-6—-+—-7– LIST ON FILE INFILE FB(80 200) IN-REC 1 80 A FILE OUTFILE FB(80 200) OUT-REC 1 80 A * WS-COUNT W 4 N VALUE 0 * JOB INPUT NULL GET INFILE DO WHILE NOT EOF [...]

READ and WRITE statements in Easytrieve

WRITE statement is used to write the record into an output file. WRITE statement can be used to write record to any kind of file. It is similar to PUT statement. —-+—-1—-+—-2—-+—-3—-+—-4—-+—-5—-+—-6—-+—-7– LIST ON FILE INFILE FB(80 200) IN-REC 1 80 A FILE OUTFILE FB(80 200) OUT-REC 1 80 A * WS-COUNT W 4 N [...]

Embedded DB2 SQL in Easytrieve

SQL statements in Easytrieve should be prefixed with the word, SQL. For eg, SQL SELECT 1 FROM + SYSIBM.SYSDUMMY1 INTO :WS-INT + is used for statement continuation in the next line. Host variable datatype mapping between Easytrieve and DB2. DB2 Datatype Number of Bytes Easytrieve variable INTEGER 4 WS-INT W 4 B SMALLINT 2 WS-SMALLINT [...]

Moving Numeric values between variables in Easytrieve

When you want to move a value from one Numeric/Packed/Binary variable to another Numeric/Packed (COMP-3) /Binary (COMP) variable, never use the MOVE verb. Just use the assignment statement using “=” (equal) symbol. This is because, MOVE will work fine, if the hexadecimally stored values are compatible. (ie, Numeric to Numeric, Packed to Packed, or Binary [...]