View previous topic :: View next topic
|
Author |
Message |
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
Hai,
Please help me with fillowing piece of code.. when WS-LEDGER-STORE-NO = STORE-NUM(T-INDEX) condition satisfies, it works well. but if they both dont match then S0C7 abend is thrown.Should we manually increment the index in this regard?or does it get auto incremented?
3000-MATCH-STORE-NOS.
IF NOT EOF-LEDGER-FILE-SW
IF WS-TRX-CODE = '999'
SET T-INDEX TO 1
SEARCH STORE-ITEMS
AT END
CONTINUE
WHEN WS-LEDGER-STORE-NO = STORE-NUM(T-INDEX)
PERFORM 4000-WRITE-INTO-OUTPUT THRU 4000-EXIT
END-SEARCH
END-IF
PERFORM 2200-READSTK-LEDGER-FILE THRU 2200-EXIT
END-IF.
3000-EXIT.
EXIT. |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
Hai
I think if they dont match, the control is going some where and you are getting that abend. Try to xpedit and find. Please correct me if I am wrong. |
|
Back to top |
|
|
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
yeah.. tat might b the case.. do we have any option to search to handle a situation if the condition is not met?.
and the table index is not getting incremented.
shud we do it manually? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
DISPLAY the values of WS-TRX-CODE, WS-LEDGER-STORE-NO & STORE-NUM(T-INDEX) & check what do they contain at the time of abend.
BTW, what other values can WS-TRX-CODE take ? What happens to the program for those other values, where the control goes ? Does that/those controls also CALL 4000-WRITE-INTO-OUTPUT THRU 4000-EXIT ? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Code: |
IF NOT EOF-LEDGER-FILE-SW
IF WS-TRX-CODE = '999'
SET T-INDEX TO 1
SEARCH STORE-ITEMS
AT END
CONTINUE
WHEN WS-LEDGER-STORE-NO = STORE-NUM(T-INDEX)
PERFORM 4000-WRITE-INTO-OUTPUT THRU 4000-EXIT
END-SEARCH
END-IF
PERFORM 2200-READSTK-LEDGER-FILE THRU 2200-EXIT
END-IF.
|
where are you getting your data exception error?
and show us the working-storage defining STORE-ITEMS |
|
Back to top |
|
|
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
ws-trx-code can take other values like 800,821 etc.. but i want it into a file only when it is 999. other conditions nothing is to be done.
well when we use SEARCH, how to handle whenthe condition is not met? |
|
Back to top |
|
|
anand tr
New User
Joined: 12 Aug 2008 Posts: 41 Location: chennai
|
|
|
|
WHEN WS-LEDGER-STORE-NO = STORE-NUM(T-INDEX) - 4000- is performed.
but when WS-LEDGER-STORE-NO is not equal to STORE-NUM(T-INDEX)
then soc7 is encountered.
so how to handle the above condition inside a search?
01 STORE-TABLE.
05 STORE-ITEMS OCCURS 1 TO 999 TIMES
DEPENDING ON REC-COUNT INDEXED BY T-INDEX.
10 STORE-NUM PIC 9(3). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
do we have any option to search to handle a situation if the condition is not met?. |
It may help if you initialize all of the numeric fields before you begin the search. It sounds like you are trying to use an uninitialized numeric field. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
It's not all that hard to analyze a S0C7 abend to determine which line of code is generating it -- that will tell you a lot about what is causing the abend. S0C7 could be only incidentally related to your SEARCH; you need to start by analyzing the S0C7, not worrying about the SEARCH statement. |
|
Back to top |
|
|
|