View previous topic :: View next topic
|
Author |
Message |
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
If you want to stop when the files are empty you have to use :
STOP EXECUTE |
|
Back to top |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Peter, at least the OP has the error checking and handling code for free |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
expat wrote: |
Peter, at least the OP has the error checking and handling code for free |
Well the bill is on its way |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
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 |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
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 |
|
|
Khushboo.goel
New User
Joined: 22 Feb 2011 Posts: 19 Location: india
|
|
|
|
Solved my prob :-)
Thankss a lot Peter for your help |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
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 |
|
|
|