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

Easytrieve - Check count & loop problem


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

New User


Joined: 22 Feb 2011
Posts: 19
Location: india

PostPosted: Fri Mar 04, 2011 2:31 pm
Reply with quote

Hi..

I need to first check if the data in two input files are zero or not.. if not then have to check whether they match or not..

JOB INPUT (UT01 KEY (INF1-ALL-REC) +
VIRT1 KEY (VIR1-ALL-REC))
IF INF1-ALL-REC = 0 OR VIR1-ALL-REC = 0
RETURN-CODE = 8
STOP
END-IF


JOB INPUT (UT01 KEY (INF1-ALL-REC) +
VIRT1 KEY (VIR1-ALL-REC))
IF MATCHED
RETURN-CODE = 0
ELSE
RETURN-CODE = 12
END-IF.


But this code is not working.. Can u let me know where I am wrong
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 04, 2011 2:40 pm
Reply with quote

If you want to stop when the files are empty you have to use :
STOP EXECUTE
Back to top
View user's profile Send private message
Khushboo.goel

New User


Joined: 22 Feb 2011
Posts: 19
Location: india

PostPosted: Fri Mar 04, 2011 3:14 pm
Reply with quote

Ya have changed that... Its working Thanks :-)

But i have got another problem..

JOB INPUT (UT01 KEY (INF1-ALL-REC) +
VIRT1 KEY (VIR1-ALL-REC))
IF INF1-ALL-REC = 0 OR VIR1-ALL-REC = 0

This gives an error that INVALID FILE REFERENCE - VIRT1

could you help me with this?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 04, 2011 3:34 pm
Reply with quote

That means that VIRT1 has no active record, and that means that the file is empty.

You could test your file like this :

JOB INPUT UT01
IF RECORD-COUNT = 0
RETURN-CODE = 8
STOP EXECUTE
END-IF
STOP
*
JOB INPUT VIRT1
IF RECORD-COUNT = 0
RETURN-CODE = 8
STOP EXECUTE
END-IF
STOP
*
put here your match/merge activity
Back to top
View user's profile Send private message
Khushboo.goel

New User


Joined: 22 Feb 2011
Posts: 19
Location: india

PostPosted: Fri Mar 04, 2011 4:18 pm
Reply with quote

Thanks Peter.. But I need to check if the value in the file is zero or not.. M nt cheking whether file is empty or not.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Mar 04, 2011 4:22 pm
Reply with quote

Well, if the input file(s) is / are empty then you can't really check anything.

I believe that Peter has given you some good error checking and handling code which you should incorporate where possible.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 04, 2011 4:39 pm
Reply with quote

Expat,

thanks for the support. But i totally misinterpreted the TS problem.
Thought he was talking about empty files, but its about fields containing zero. So i have to reconsider his problem.
There are these possibilities :

both files match with zero in both fields
they dont match cause 1 of both files could have zero in the field

or

both files match with non zero values
they dont match with non zero values

so the TS has to write some logic around these conditions.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Mar 04, 2011 4:42 pm
Reply with quote

Peter, at least the OP has the error checking and handling code for free icon_lol.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 04, 2011 4:50 pm
Reply with quote

expat wrote:
Peter, at least the OP has the error checking and handling code for free icon_lol.gif


Well the bill is on its way icon_rolleyes.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 04, 2011 5:04 pm
Reply with quote

Ok, im not in a too bad mood. So the logic could be something like this :

Code:

IF MATCHED
   IF INF1-ALL-REC = 0 AND VIR1-ALL-REC = 0
      RETURN-CODE = 8
      STOP EXECUTE
   END-IF
*  other prcessing   
END-IF
IF NOT MATCHED
   IF UT01 AND INF1-ALL-REC = 0
      RETURN-CODE = 12
      STOP EXECUTE
   END-IF
   IF VIRT1 AND VIR1-ALL-REC = 0
      RETURN-CODE = 16
      STOP EXECUTE
   END-IF
*  other processing
END-IF
Back to top
View user's profile Send private message
Khushboo.goel

New User


Joined: 22 Feb 2011
Posts: 19
Location: india

PostPosted: Tue Mar 08, 2011 10:24 am
Reply with quote

Hi Peter..

Thanks for the code... but its not working :-(

even if the counts are similar they go into the non matched loop :-(

my main objective is :

first to check if both the files contain zero or not.. if yes then return maxcc=8

if not then check if the count in both files are equal.. if yes then return maxcc=0 else maxcc=12..

Please help
Back to top
View user's profile Send private message
Khushboo.goel

New User


Joined: 22 Feb 2011
Posts: 19
Location: india

PostPosted: Tue Mar 08, 2011 10:37 am
Reply with quote

This is my code:


Code:
FILE UT01
INF1-ALL-REC        1  8  N

FILE UT02
INF2-ALL-REC        1  8  N

FILE VIRT1 F(8) VIRTUAL
VIR1-ALL-REC        1  8  N

WS-SUB                         W   8  N VALUE 11

JOB INPUT UT02
    INF2-ALL-REC = INF2-ALL-REC - WS-SUB
    PUT VIRT1 FROM UT02


JOB INPUT (UT01  KEY (INF1-ALL-REC)           +
               VIRT1 KEY (VIR1-ALL-REC))
     IF MATCHED
        IF INF1-ALL-REC = 0 AND VIR1-ALL-REC = 0
           DISPLAY 'MATCHED ZERO'
           RETURN-CODE = 8
           STOP EXECUTE
     *  OTHER PROCESSING
        ELSE
        ELSE
           DISPLAY 'MATCHED'
           RETURN-CODE = 0
           STOP EXECUTE
        END-IF
     ELSE
     IF NOT MATCHED
           DISPLAY 'NT MATCHED'
           RETURN-CODE = 12
           STOP EXECUTE
     END-IF
     END-IF


I am very new to Easytrieve... Please help me out with this..
Back to top
View user's profile Send private message
Khushboo.goel

New User


Joined: 22 Feb 2011
Posts: 19
Location: india

PostPosted: Tue Mar 08, 2011 10:51 am
Reply with quote

Solved my prob :-)

Thankss a lot Peter for your help icon_smile.gif
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 Mar 08, 2011 8:53 pm
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

Quote:
Solved my prob :-)
How was the problem solved? It will probably help someone else if you post what caused the problem and how it was fixed.

d
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 To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top