Wrete a JCL to compare two files and mached records move to
onc file & un mached rows wants to another file?

Answer Posted / ashish uplenchwar

ID DIVISION.

PROGRAM-ID. COMP1.

ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

FILE-CONTROL.

SELECT F1 ASSIGN TO DD1

ORGANIZATION IS SEQUENTIAL

ACCESS MODE IS SEQUENTIAL

FILE STATUS FS1.

SELECT F2 ASSIGN TO DD2

ORGANIZATION IS SEQUENTIAL

ACCESS MODE IS SEQUENTIAL

FILE STATUS FS2.

SELECT F3 ASSIGN TO DD3

ORGANIZATION IS SEQUENTIAL

ACCESS MODE IS SEQUENTIAL

FILE STATUS FS3.

SELECT F4 ASSIGN TO DD4

ORGANIZATION IS SEQUENTIAL

ACCESS MODE IS SEQUENTIAL

FILE STATUS FS4.

DATA DIVISION.

FILE SECTION.

FD F1.

01 FILE1.

02 F1EID PIC X(2).

02 FNAME PIC X(5).

02 FILLER PIC X(73).

FD F2.

01 FILE2.

02 F2EID PIC X(2).

02 LNAME PIC X(5).

02 FILLER PIC X(73).

FD F3.

01 FILE3.

02 F3EID PIC X(2).

02 FNAME1 PIC X(5).

02 LNAME1 PIC X(5).

02 FILLER PIC X(68).

FD F4.

01 FILE4.

02 F4EID PIC X(2).

02 FNAME3 PIC X(5).

02 LNAME3 PIC X(5).

02 FILLER PIC X(68).

WORKING-STORAGE SECTION.

77 FS1 PIC 9(2).

77 FS4 PIC 9(2).

77 FS2 PIC 9(2).

77 FS3 PIC 9(2).

01 TABLE1.

02 TAB1 OCCURS 5 TIMES INDEXED BY A1.

03 EID1 PIC X(2).

03 FNAME2 PIC X(5).

01 TABLE2.

02 TAB2 OCCURS 5 TIMES INDEXED BY A2.

03 EID2 PIC X(2).

03 LNAME12 PIC X(5).

PROCEDURE DIVISION.

OPEN INPUT F1.

OPEN INPUT F2.

OPEN OUTPUT F3.

OPEN OUTPUT F4.

PERFORM UNTIL FS1 = 10

READ F1

IF FS1 = 00 THEN

MOVE F1EID TO EID1(A1)

MOVE FNAME TO FNAME2(A1)

END-IF

SET A1 UP BY 1

END-PERFORM.

CLOSE F1.

PERFORM UNTIL FS2 = 10

READ F2

IF FS2 = 00 THEN

MOVE F2EID TO EID2(A2)

MOVE LNAME TO LNAME12(A2)

END-IF

SET A2 UP BY 1

END-PERFORM.

CLOSE F2.

SET A1 TO 1.

OPEN INPUT F2.

PERFORM UNTIL FS2 = 10

SET A1 TO 1

READ F2

IF FS2 = 00 THEN

SEARCH TAB1 AT END PERFORM P1

WHEN EID1(A1) = F2EID PERFORM P2

END-SEARCH

END-IF

END-PERFORM.

SET A2 TO 1.

OPEN INPUT F1.

PERFORM UNTIL FS1 = 10

SET A2 TO 1

READ F1

IF FS1 = 00 THEN

SEARCH TAB2 AT END PERFORM P3

WHEN EID2(A2) = F1EID PERFORM P4

END-SEARCH

END-IF

END-PERFORM.

CLOSE F2 , F3 ,F4.

STOP RUN.

P1.

MOVE FILE2 TO FILE4.

WRITE FILE4.

P2.

MOVE EID1(A1) TO F3EID.

MOVE FNAME2(A1) TO FNAME1.

MOVE LNAME TO LNAME1.

WRITE FILE3.

P3.

MOVE FILE1 TO FILE4.

WRITE FILE4.

P4.

MOVE EID2(A2) TO F3EID.

MOVE FNAME2(A2) TO FNAME1.

MOVE LNAME TO LNAME1.

WRITE FILE3.



Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do we mean by 'Virtual storage' for a dataset and for a JOBSTEP ? What is the significance of the following statement for a programmer 'Virtual storage results in program addresses being independent of the addresses that actually exist in a computer' ?

1587


What is the function of //cntl statement?

831


define cond parameter in jcl?

778


What are the 2 types of parameters in dd statement?

652


I want to JCL sort for Non-COMP and COMP-3 fields SORT FIELDS=(1,5,A,6,11,A,12,11,A,19,1,A,20,1,A),FORMAT=BI,EQUALS Length of comp bytes is 11 bytes which start at 6byte and 12 byte considering 11 bytes in comp-3 is 6 bytes. Can anyone tell if the above sort work SORT FIELDS=(1,5,A,6,6,A,12,6,A,19,1,A,20,1,A),FORMAT=BI,EQUALS does not works OK

1485






What is the function of the dd mgmtclas keyword in sms datasets?

740


what happens in execution stage in job processing?

657


Describe the various parameters utilized in the creation of a gdg?

684


What do you understand by the term “keyword” with respect to jcl and what is the opposite of the term?

679


When space is allocated for an output dataset, what units can be used?

751


How dummy is used in jcl?

651


Name the parameters which can be used to limit the number of records written to a sysout dataset?

654


Explain the purpose of dd * statement in jcl?

643


1) SORT FIELDS=(20,4,CH,D,10,3,CH,D) OUTREC FIELDS=(7:20,4,C' FUTURE ',20,2,10,3,1Z,1,9,13,7, 24,57,TRAN=LTOU,6X'FF') This example illustrates how a fixed-length input data set can be sorted and reformatted for output. The SORTIN LRECL is 80 bytes. The reformatted output records are fixed length with a record size of 103 bytes. SOLRF (the IBM-supplied default) is in effect, so unless the SORTOUT LRECL is specified or available, it will automatically be set to the reformatted record length of 103. in the above example i have some doubts that a) sort fields=(20,4,CH,D,10,3,CH,D) -what exactly it does and this fields related to output record fields or input record fields b)outrec used to refprmat the records after sorting that means could please reply me as soon as possible Thanks. Venkat

7088


A chkpt is the parameter coded for multi-volume qsam datasets in a dd statement. When a chkpt is coded as chkpt=eov, a checkpoint is written to the dataset specified in the sysckeov statement at the end of each volume of the input/output multi-volume dataset. State whether true or false?

738