IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Easytrieve plus matching logic


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bhoja

New User


Joined: 31 Jan 2006
Posts: 49

PostPosted: Tue May 22, 2007 3:00 pm
Reply with quote

I have 2 files(X and Y). Suppose one record 'n' present in both files, it means updated. suppose it present in X file and not in Y file means deleted. If the no of deleted from file X means not present in file Y is greater than 5% abend the program. Could someone help me to write the easytrieve logic for this.

Thanks in advanvce

Regards
raj
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue May 22, 2007 3:31 pm
Reply with quote

We would be glad to help, what do you have so far?
Back to top
View user's profile Send private message
bhoja

New User


Joined: 31 Jan 2006
Posts: 49

PostPosted: Tue May 22, 2007 4:10 pm
Reply with quote

I wrote the program for the above requirement. In that 6 are primary keys, we have to take all the 6 keys into account for comparision. This code is not fulpilling my requirement. Could you please suggest the necessary changes on this code. I am totally new to easytrieve.

Code:
//*=====================================================================0000000
//VEASY01   EXEC PGM=EZTPA00                                            0000000
//STEPLIB  DD DISP=SHR,DSN=SW.PANPLUS.LOAD                              0000000
//PANDD    DD DISP=SHR,DSN=SW.PANPLUS.MACLIB                            0000000
//SYSPRINT DD SYSOUT=*,OUTLIM=900000                                    0000000
//SYSOUT   DD SYSOUT=*,OUTLIM=900000                                    0000000
//FILEA DD DISP=OLD,DSN=*****************
//FILEB DD DISP=OLD,DSN=******************
//SYSIN DD *
FILE FILEA
*
    INREC-A            1    111     A
    A-BOBY-RD-PART-NO   1    2       A
    A-BOBY-RO-NO        3    5       P
    A-BOBY-STK-CTR-NO   8    5       P
    A-BOBY-OG-CD        13   2       A
    A-BOBY-ORD-TYPE     15   1       A
    A-BOBY-REQ-DEL-DT   16   10      A
    A-BOBY-REQ-DEL-TM   26   8       A
    A-BOBY-CALC-RUN-DT  34   10      A
    A-BOBY-CALC-RUN-TM  44   8       A
    A-BOBY-CALC-RUN-ID  52   1       A
    A-BOBY-CALC-TYPE    53   1        A
    A-BOBY-EXT-RUN-DT   54   10      A
    A-BOBY-EXT-RUN-ID   64   1       A
    A-BOBY-EXT-IND      65   1       A
    A-BOBY-ACT-CALC-DT  66   10      A
    A-BOBY-ACT-CALC-TM  76   8       A
    A-BOBY-ACT-EXT-DT   84   10      A
    A-BOBY-ACT-EXT-TM   94   8       A
    A-BOBY-ORD-NO       102  9       P
    A-BOBY-UPDT-IND     111  1       A

*   *
 FILE FILEB
*
  INREC-B              1    111     A
    B-BOBY-RD-PART-NO   1    2       A
    B-BOBY-RO-NO        3    5       P
    B-BOBY-STK-CTR-NO   8    5       P
    B-BOBY-OG-CD        13   2       A
    B-BOBY-ORD-TYPE     15   1       A
    B-BOBY-REQ-DEL-DT   16   10      A
    B-BOBY-REQ-DEL-TM   26   8       A
    B-BOBY-CALC-RUN-DT  34   10      A
    B-BOBY-CALC-RUN-TM  44   8       A
    B-BOBY-CALC-RUN-ID  52   1       A
    B-BOBY-CALC-TYPE    53   1        A
    B-BOBY-EXT-RUN-DT   54   10      A
    B-BOBY-EXT-RUN-ID   64   1       A
    B-BOBY-EXT-IND      65   1       A
    B-BOBY-ACT-CALC-DT  66   10      A
    B-BOBY-ACT-CALC-TM  76   8       A
    B-BOBY-ACT-EXT-DT   84   10      A
    B-BOBY-ACT-EXT-TM   94   8       A
    B-BOBY-ORD-NO       102  9       P
    B-BOBY-UPDT-IND     111  1       A

*
FILE FILEC
*
  INREC-C            1    111     A
*
FILE FILED
  INREC-D            1    111     A
*
    WCNT               S    4       P 0
    WDEL               S    4       P 0
*
**********************************************************************
* MAIN PROCEDURE
**********************************************************************
*
JOB INPUT (FILEA KEY(A-BOBY-RD-PART-NO) FILEB KEY(B-BOBY-RD-PART-NO))
JOB INPUT (FILEA KEY(A-BOBY-RO-NO) FILEB KEY(B-BOBY-RO-NO))
JOB INPUT (FILEA KEY(A-BOBY-ORD-TYPE)FILEB KEY(B-BOBY-ORD-TYPE))
JOB INPUT (FILEA KEY(A-BOBY-REQ-DEL-DT) FILEB KEY(B-BOBY-REQ-DEL-DT))
JOB INPUT (FILEA KEY(A-BOBY-STK-CTR-NO) FILEB KEY(B-BOBY-STK-CTR-NO))
 WCNT = WCNT + 1

 IF MATCHED
*
     IF INREC-A = INREC-B
         GOTO JOB
     ELSE

         PUT FILEC FROM FILEB
         GOTO JOB
     END-IF
 END-IF
*******RECORD FOUND IN PREVIOUS ONLY, IT IS A DELETE
  IF FILEA
    PUT FILED FROM FILEA
    MOVE FILEA TO WDEL
        IF  WDEL > (0.05 * (WDEL + 1))
          MOVE 5 TO RETURN-CODE
          DISPLAY 'NO OF RECORDS DELETED FROM DRY TABLE IS MORE THAN 5%'
          DISPLAY 'WCNT=' WCNT
          STOP
        ELSE
          GOTO JOB
        END-IF
  ELSE
*
******* RECORD FOUND IN CURRENT ONLY, IT IS AN ADD
         IF FILEB

           PUT FILEC FROM FILEB
         END-IF
  END-IF.
*****

Thanks
raj
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue May 22, 2007 5:16 pm
Reply with quote

This might get you started a bit better, the JOB statement should look more like this:
Code:

JOB INPUT (FILEA KEY(A-BOBY-RD-PART-NO,
                     A-BOBY-RO-NO,
                     A-BOBY-ORD-TYPE,
                     A-BOBY-REQ-DEL-DT,
                     A-BOBY-STK-CTR-NO)
           FILEB KEY(B-BOBY-RD-PART-NO,
                     B-BOBY-RO-NO,
                     B-BOBY-ORD-TYPE,
                     B-BOBY-REQ-DEL-DT,
                     B-BOBY-STK-CTR-NO))

Have you looked at the examples on syncronized file processing in the reference and application guides?
Back to top
View user's profile Send private message
bhoja

New User


Joined: 31 Jan 2006
Posts: 49

PostPosted: Tue May 22, 2007 5:32 pm
Reply with quote

Thank you very much William.
Do you feel other codes are correct, I have a doubt on that part. My requirement is, if the file X record not present in file Y, it means deleted. The total records deleted is more than 5%, then the program should abend. Our CA7 wont handle the return code more than 3, so I am passing the return code of 5 to the program for abending.

Could you please look into the body of the program, and let me know what else I need to modify on this.

raj
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue May 22, 2007 7:00 pm
Reply with quote

I'm new to EZT also, and even newer to the matching logic.
If I had your requirement, I would experiment with smaller sample files and start simple.
First I'd try to see if I can identify (with a display) the matching vs the unmatching.
Once I could be sure that I could identify them correctly, I'd add in the counting of records total and the counting of numcatched. Then at end of file, I could check the percentages and exit with a return code if needed.
But I would start simple and just see if I could get it to work piece by piece.
Back to top
View user's profile Send private message
bhoja

New User


Joined: 31 Jan 2006
Posts: 49

PostPosted: Wed May 23, 2007 1:48 pm
Reply with quote

Hi,
anyone is having the easyplus syntax for this.
I have a file and I dont know the no. of records in it. If the no. of record is more than the 5% of total record, then I have to abend the program.
Please anyone is having the easytrieve syntax for this. please share with me.

Thanks in advance.
raj icon_sad.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed May 23, 2007 3:46 pm
Reply with quote

percentage = errors / total
where 5% would be .05
at end, if errors / total > .05, abend
Back to top
View user's profile Send private message
bhoja

New User


Joined: 31 Jan 2006
Posts: 49

PostPosted: Wed May 23, 2007 3:52 pm
Reply with quote

Thanks for the update William.
Can I have the syntax please.

raj
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed May 23, 2007 4:04 pm
Reply with quote

William Thompson wrote:
Have you looked at the examples on syncronized file processing in the reference and application guides?
Back to top
View user's profile Send private message
bhoja

New User


Joined: 31 Jan 2006
Posts: 49

PostPosted: Fri May 25, 2007 5:50 pm
Reply with quote

My requirement is, compare the two files (A and B), if present in both the files, write into one file (file C). If present in first file but not in second file, means it is deleted and write into another file (file D). Like wise if present in second file but not in first file means inserted and write into one file (file E).
Below is the code I am using for the requirement. I am getting wrong result.

Code:
* MAIN PROCEDURE                                                     
**********************************************************************
*                                                                     
JOB INPUT (FILEA KEY(KEY-A) FILEB KEY(KEY-B))       
                                                                     
 IF MATCHED                                                           
*                                                                     
     IF INREC-A = INREC-B                                             
         PUT FILEC FROM FILEB                                         
         GOTO JOB                                                     
     ELSE                                                             
                                                                     
         GOTO JOB                                                     
     END-IF                                                           
 END-IF                                                               
*******RECORD FOUND IN PREVIOUS ONLY, IT IS A DELETE                 
IF NOT MATCHED                                                   
  IF FILEA                                                         
    PUT FILED FROM FILEA                                           
    WDEL = WDEL + 1                                               
  ELSE                                                             
*                                                                 
******* RECORD FOUND IN CURRENT ONLY, IT IS AN ADD                 
         IF FILEB                                                 
           PUT FILEE FROM FILEB                                   
         END-IF                                                   
  END-IF                                                           
 END-IF.                                                           
*****                                                             

My inputs are,
FileA - 59
FileB - 59
Outputs what I am getting is
FileC - 58 correct (out of 59 one record is not present in fileB, so it is 58.
FileD - 50 (wrong) (it should have to come 1 record only)
FileE - 1 correct

Could anybody please help me on this.
Back to top
View user's profile Send private message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Fri May 25, 2007 6:07 pm
Reply with quote

Code:
000001 *                                                                       
000002  FILE IGCNSFD                                                           
000003     IGCNSFD-REC                          1   3000     A                 
000004     IGCNSFD-MSG-TR-ID                 1069     15     P                 
000005     IGCNSFD-MSG-TY-ID                   26      4     A                 
000006 *                                                                       
000007  FILE ILODRED                                                           
000008     ILODRED-REC                          1   1865     A                 
000009     ILODRED-MSG-TR-ID                   13     18     P                 
000010     ILODRED-MSG-TY-ID                   24      4     A                 
000011     ILODRED-ISS-RPT-MKT-NM            1051     30     A                 
000012 *                                                                       
000013  FILE OUTMCH                                                           
000014     OUTFILE-M                            1   1865     A                 
000015 *                                                                       
000016  FILE OUTNEW                                                           
000017     OUTFILE-NM                           1   3000     A                 
000018 *                                                                       
000019  FILE OUTREJ                                                           
000020     OUTFILE-RJ                           1   1865     A                 
000021 *                                                                       
000022  JOB INPUT  ( IGCNSFD KEY (IGCNSFD-MSG-TR-ID, IGCNSFD-MSG-TY-ID) +     
000023               ILODRED KEY (ILODRED-MSG-TR-ID, ILODRED-MSG-TY-ID))       
000024   IF MATCHED                                                           
000025                                       
000026         OUTFILE-M  = ILODRED-REC                                       
000027         PUT OUTMCH                                                     
000028      END-IF                                                             
000029   ELSE                                                                 
000030      IF IGCNSFD                                                         
000031         OUTFILE-NM = IGCNSFD-REC                                       
000032         PUT OUTNEW                                                     
000033      END-IF                                                             
000034      IF ILODRED                                                         
000035         OUTFILE-RJ = ILODRED-REC                                       
000036         PUT OUTREJ                                                     
000037      END-IF                                                             
000038   END-IF                                                               
 ****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Fri May 25, 2007 6:09 pm
Reply with quote

jaspal wrote:
Code:
000001 *                                                                       
000002  FILE IGCNSFD                                                           
000003     IGCNSFD-REC                          1   3000     A                 
000004     IGCNSFD-MSG-TR-ID                 1069     15     P                 
000005     IGCNSFD-MSG-TY-ID                   26      4     A                 
000006 *                                                                       
000007  FILE ILODRED                                                           
000008     ILODRED-REC                          1   1865     A                 
000009     ILODRED-MSG-TR-ID                   13     18     P                 
000010     ILODRED-MSG-TY-ID                   24      4     A                 
000011     ILODRED-ISS-RPT-MKT-NM            1051     30     A                 
000012 *                                                                       
000013  FILE OUTMCH                                                           
000014     OUTFILE-M                            1   1865     A                 
000015 *                                                                       
000016  FILE OUTNEW                                                           
000017     OUTFILE-NM                           1   3000     A                 
000018 *                                                                       
000019  FILE OUTREJ                                                           
000020     OUTFILE-RJ                           1   1865     A                 
000021 *                                                                       
000022  JOB INPUT  ( IGCNSFD KEY (IGCNSFD-MSG-TR-ID, IGCNSFD-MSG-TY-ID) +     
000023               ILODRED KEY (ILODRED-MSG-TR-ID, ILODRED-MSG-TY-ID))       
000024   IF MATCHED                                                           
000025                                       
000026         OUTFILE-M  = ILODRED-REC                                       
000027         PUT OUTMCH                                                     
000028      END-IF                                                             
000029   ELSE                                                                 
000030      IF IGCNSFD                                                         
000031         OUTFILE-NM = IGCNSFD-REC                                       
000032         PUT OUTNEW                                                     
000033      END-IF                                                             
000034      IF ILODRED                                                         
000035         OUTFILE-RJ = ILODRED-REC                                       
000036         PUT OUTREJ                                                     
000037      END-IF                                                             
000038   END-IF                                                               
 ****** **************************** Bottom of Data ****************************



CHANGE THE FILES AND REC LENGTH ACORDINGLY AND KEY IT WILL WORK ,
1) FIRST FILE IT WILL GIVE RECORDS WHICH ARE IN BOTH FILES
2)NOT IN 2ND FILE
3) NOT IN THIRD FILE
Back to top
View user's profile Send private message
bhoja

New User


Joined: 31 Jan 2006
Posts: 49

PostPosted: Fri May 25, 2007 6:41 pm
Reply with quote

Jaspal,
I am getting the same old result.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Rexx pattern matching on PS qualifer ... CLIST & REXX 1
No new posts Finding faulty logic Subscript out of... COBOL Programming 5
No new posts Count the number of characters in a f... CA Products 1
No new posts File matching functionality in Easytr... DFSORT/ICETOOL 14
This topic is locked: you cannot edit posts or make replies. Need assistance in job scheduling logic. Mainframe Interview Questions 2
Search our Forums:

Back to Top