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

Please Help me How to achieve in record match in Eztrieve


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

New User


Joined: 10 Jul 2012
Posts: 22
Location: india

PostPosted: Tue Jan 28, 2014 12:52 am
Reply with quote

Hi
Code:

FBSI-BRCH-C FBSI-BASE-C FBSI-ACC-TY-C ENTR-D     WH-TYPE  SEQ-N    CUSP-NBR
3/AN        6/AN        1/AN          10/AN      3/AN     2/BI     9/AN     
(1-3)       (4-9)       (10-10)       (11-20)    (21-23)  (24-25)  (26-34) 
1---------- 2---------- 3------------ 4--------- 5------- 6------- 7--------
AEL               367028            1                   2013-04-02    WHD                   0    543487144
AEL               367028            1                   2013-04-15    SAA                   0    316390327
AEL               367028            1                   2013-04-15    WHD                   0    316390327
AEL               367028            1                   2013-04-15    WHD                   1    316390327
AEL               367028            1                   2013-04-30    WHD                   0    922021407
AEL               367028            1                   2013-04-30    WHD                   1    68380T103
AEL               367028            1                   2013-04-30    WHI                   0    FDIC66606
AEL               367028            1                   2013-05-01    WHD                   0    552986309
AEL               367028            1                   2013-05-02    WHD                   0    543487144
AEL               367028            1                   2013-05-31    WHD                   0    922021407
AEL               367028            1                   2013-05-31    WHD                   1    68380T103
AEL               367028            1                   2013-05-31    WHI                   0    FDIC66606
AEL               367028            1                   2013-06-03    SAA                   0    552986309
AEL               367028            1                   2013-06-03    WHD                   0    552986309
AEL               367028            1                   2013-04-02    WHD                   0    543487144
AEL               367028            1                   2013-04-15    SAA                   0    316390327
AEL               367028            1                   2013-04-15    WHD                   0    316390327
AEL               367028            1                   2013-04-15    WHD                   1    316390327
AEL               367028            1                   2013-04-30    WHD                   0    922021407
AEL               367028            1                   2013-04-30    WHD                   1    68380T103
AEL               367028            1                   2013-04-30    WHI                   0    FDIC66606
AEL               367028            1                   2013-05-01    WHD                   0    552986309
AEL               367028            1                   2013-05-02    WHD                   0    543487144
AEL               367028            1                   2013-05-31    WHD                   0    922021407
AEL               367028            1                   2013-05-31    WHD                   1    68380T103
AEL               367028            1                   2013-05-31    WHI                   0    FDIC66606
AEL               367028            1                   2013-06-03    SAA                   0    552986309
AEL               367028            1                   2013-06-03    WHD                   0    552986309



There are records in this file,in that one field WH-TYPE having value SAA , my requirement is like , i need to comapare SAA having record with other records except WH-TYPE field, we need to compare all the fields. if that record matching to any other record , i need to Append matching record to SAA having record and write in to outfile, if SAA having record is not matching any other record that is also write to file.

I have written code below as i am new to Eztrieve ,i struggle to write this code , as per logic i feel this code is fine, But when i tried to execute this , i am getting END OF FILE error code.

Code:

FILE INFILE FB             
                           
   IN-REC         1  186 A
   FBSI-ACC-TY-C 10  1 A   
   ENTR-D        11  10 A 
   WH-TYPE       21  3  A 
   CUSP-NBR      26  9  A 
   KEY-C         35  2  A 
   ENTR-C        37  3  A 
   BKPG-AMT      40  6 P 2
   ST-C         116  2 A   
                           
FILE OUTFILE FB           
   OUT-REC    1   373 A   
                         
   WS-GREC       W 373 A
     WS-REC1 WS-REC  186 A
     WS-REC2 WS-REC  +187 186 A
     
   WS-FBSI-ACC-TY-C W 1 A
   WS-ENTR-D    W 10 A   
   WS-CUSP-NBR  W 9 A     
   WS-KEY-C     W 2 A     
   WS-ENTR-C    W 3 A     
   WS-BKPG-AMT  W 6 P 2   
   WS-ACC-TYPE  W 1 A
   WS-MATCH-IND   W 1 A     
*                                             
 JOB INPUT NULL                               
 GET INFILE                                   
*                                             
   DO WHILE NOT EOF INFILE                   
      IF WH-TYPE = 'SAA' AND    +             
         ( ST-C = 'CA' OR ST-C = 'ME' OR    +
                        ST-C = 'VT' OR     + 
                        ST-C = 'SC' )         
             MOVE SPACES   TO WS-SAA-IND     
             MOVE SPACES   TO WS-ENTR-D       
             MOVE SPACES   TO WS-CUSP-NBR     
             MOVE SPACES   TO WS-KEY-C       
             MOVE SPACES   TO WS-ENTR-C       
             MOVE 0        TO WS-BKPG-AMT     
*                                             
*                                             
                 
             MOVE IN-REC   TO WS-REC1           
             MOVE ENTR-D   TO WS-ENTR-D       
             MOVE CUSP-NBR TO WS-CUSP-NBR     
             MOVE KEY-C    TO WS-KEY-C         
             MOVE ENTR-C   TO WS-ENTR-C       
             MOVE BKPG-AMT TO WS-BKPG-AMT     
                                 
      END-IF
     
     GET INFILE   
     DO WHILE NOT EOF INFILE                                       
                           
           IF ENTR-D   = WS-ENTR-D    AND   + 
              CUSP-NBR = WS-CUSP-NBR  AND   + 
              KEY-C    = WS-KEY-C     AND   + 
              ENTR-C   = WS-ENTR-C    AND   + 
              BKPG-AMT = WS-BKPG-AMT  AND   +           
              ACC-TYPE = WS-ACC-TYPE                                     
             
                   
              MOVE 'Y' TO    WS-MATCH-IND                                         
              MOVE IN-REC TO WS-REC2
                                                       
           ELSE
              MOVE 'N' TO WS-MATCH-IND
              MOVE SPACES TO WS-REC2                             
           END-IF 
       GET INFILE                   
     END-DO
     
   IF WS-MATCH-IND = 'Y'
      MOVE WS-GREC TO OUT-REC
      PUT OUTFILE
   ELSE
                                             
      MOVE WS-GREC TO OUT-REC
      PUT OUTFILE
   END-IF
      GET INFILE                             
   END-DO                                     
   STOP.

Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jan 28, 2014 1:11 am
Reply with quote

Hello,

Maybe i'm missing something, but i don't see how you tell the code to end. . .

So it reads beyond EOF.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jan 28, 2014 2:06 pm
Reply with quote

You have a second DO loop within the first. That loop is UNTIL EOF. After that loop you do another GET, so after EOF.

This relates to your SORT question previously? Why didn't you just provide the information requested there, rather than attempting something in Easytrieve Pluse?
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Tue Jan 28, 2014 3:42 pm
Reply with quote

Here is the logic for your requirement (if I understood correctly icon_smile.gif )

Code:
Read 1st Record
Loop until END-OF-FILE
  if type = 'SAA' then
     move file-values   to Ws-fields
     move file-record   to output-rec

     set next-SAA-found = 'N'
     Loop until END-OF-FILE or next-SAA-found = 'Y'
       Read next-record
       if type = 'SAA' then
          set next-SAA-found = 'Y'
       else
          if file-value = ws-fields then
              append file-record to output-record
          end-if
       end-if
     end-Loop
  write output-record (if you want only SAA in output)
  end-if
   
  write output-record (if you want all records along with SAA in output)

  if not END-OF-FILE AND next-SAA-found not = 'Y' then
      Read next-record
  end-if

end-Loop


Note: only one Write output-record should be there. So remove one statement as per your requirement.
Back to top
View user's profile Send private message
srinivasulu.p

New User


Joined: 10 Jul 2012
Posts: 22
Location: india

PostPosted: Tue Jan 28, 2014 11:51 pm
Reply with quote

Thank you so much for your reply, exactly same i am looking , but this can be do it in Easytrieve, or COBOL program.since it is a single file if we open the file ,when we read a record its going to be a first record ryt, how can we handle it, pls help me



sureshpathi10 wrote:
Here is the logic for your requirement (if I understood correctly icon_smile.gif )

Code:
Read 1st Record
Loop until END-OF-FILE
  if type = 'SAA' then
     move file-values   to Ws-fields
     move file-record   to output-rec

     set next-SAA-found = 'N'
     Loop until END-OF-FILE or next-SAA-found = 'Y'
       Read next-record
       if type = 'SAA' then
          set next-SAA-found = 'Y'
       else
          if file-value = ws-fields then
              append file-record to output-record
          end-if
       end-if
     end-Loop
  write output-record (if you want only SAA in output)
  end-if
   
  write output-record (if you want all records along with SAA in output)

  if not END-OF-FILE AND next-SAA-found not = 'Y' then
      Read next-record
  end-if

end-Loop


Note: only one Write output-record should be there. So remove one statement as per your requirement.
Quote:
Quote:
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Jan 29, 2014 7:23 am
Reply with quote

srinivasulu.p wrote:
this can be do it in Easytrieve, or COBOL program.

I would say, whatever you are best at will be fine.

srinivasulu.p wrote:
since it is a single file if we open the file ,when we read a record its going to be a first record ryt, how can we handle it, pls help me

I didn't understand what do you want to help with. It doesn't matter, single/multiple files. if you open any sequential file and read, it is going to be the first record.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top