Tags

, , , , , , , ,

EASYTRIEVE – SORT and FILE COMPARISION

FILE PERSNL FB(150 1800)

OLD-EMP# 9 5 N

*

FILE PERSUPD CARD

EMP# 1 5 N

RAISE-PERCENT 7 2 N

*

FILE SORTPER F 150 VIRTUAL

UPD-EMP# 9 5 N

NAME 17 8 A

PAY-GROSS 94 4 P 2

NEWSAL W 4 P 2

*

FILE NEWPERS FB(150 1800)

*

FILE ERRPRINT PRINTER

*

*

SORT PERSNL TO SORTPER USING OLD-EMP#

*

JOB INPUT (SORTPER KEY(UPD-EMP#) +

PERSUPD KEY(EMP#) )

*

IF MATCHED

PRINT NEW-RPT

END-IF

IF SORTPER

PUT NEWPERS FROM SORTPER

ELSE

DISPLAY ERRPRINT EMP# ‘RECORD NOT MATCHED’

END-IF

*

REPORT NEW-RPT LINESIZE 80 NOPAGE NODATE

SEQUENCE NAME

TITLE 1 ‘SALARY UPDATE REPORT’

HEADING UPD-EMP# (‘EMPL’ ‘NUMBER’)

LINE UPD-EMP# NAME PAY-GROSS NEWSAL RAISE-PERCENT

*

END

  1. SORT statement sorts the input file PERSNL into the temporary file SORTPER in the ascending order of OLD-EMP#

    SORT PERSNL TO SORTPER USING OLD-EMP#

  2. JOB statement takes the INPUT as both the files to be compared. Ensure that the files are sorted based on the key specified. Number of keys and data type of each key should be same.

    JOB INPUT (SORTPER KEY(UPD-EMP#) +

    PERSUPD KEY(EMP#) )

  3. [NOT] MATCHED – This specifies that the record with the same key is present in both the files.

    IF MATCHED

    PRINT NEW-RPT

    END-IF

  4. IF [NOT] EOF Filename – EOF specifies that the end of file is met. And only using the filename specifies that the record is present in that file.

    IF SORTPER – specifies that record is available in the file SORTPER

    IF EOF SORTPER – validates true when the End of file is reached for the file SORTPER

  5. RECORD RELATIONAL CONDITION
    1. DUPLICATE – Current record is compared with previous and next record and if it is same as either of the two then the result is true.
    2. FIRST-DUPThe current record of the named file is compared to the previous and next records of the same file. The result is true if the current record’s key is different from the previous record’s key but the same as the next record’s key.
    3. LAST-DUPThe current record of the named file is compared to the previous and next records of the same file. The result is true if the current record’s key is the same as the previous record’s key but different from the next record’s key.

    ——————————————————————————————————–

    In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog

    ——————————————————————————————————–

    You may also like to look at:

    Working on Mainframes – Is Change to a different technology necessary
    Important SQL CODES and ABEND CODES
    SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
    KNOW YOUR MAINFRAME
    REXX – INITIAL SETUP
    EASYTRIEVE – A023 ABEND
    EASYTRIEVE – SORT and FILE COMPARISION
    EASYTRIEVE – Special-name Report Procedures
    EASYTRIEVE – REPORT STAEMENT
    EASYTRIEVE – Sample Program – Table And Search
    EASYTRIEVE – Sample Program – Display Totals and Summary
    EASYTRIEVE – Sample Program – Display Employee Data
    CA-Easytrieve/Plus – Basics
    REXX TOOL # 02 – FSAVE – Save member opened in VIEW mode
    REXX TOOL # 01 – O – Open Any Mainframe Element from any ISPF Screen
    REXX – INDEX, POS, SUBSTR, COMPARE
    REXX – READ THE DSN PROVIDED AS DD IN JCL
    REXX – SEND MULTIPLE ARGUMENTS THROUGH JCL
    REXX – HOW TO COMPILE YOUR REXX EXEC
    REXX – CHANGE UPPER TO LOWER CASE
    REXX – GET LAST 4 DAYS FROM GIVEN DATE
    REXX – PANEL Definition
    REXX – READ, CREATE AND WRITE DATA TO A DATASET
    REXX TOOL TO SUBSTITUTE SYMBOLICS IN A PROC

     

Advertisement