Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, The following code just disp 2

Status
Not open for further replies.

soniabharat

Programmer
Aug 9, 2001
18
US
Hi,

The following code just displays the message Attorney updated'
CALL WOWSETPROP USING WIN-RETURN DETAIL-STATUS-H
'CURSECTION' 0
'SECTIONSTATUS' 'Attorney Updated'

This code is executing fine. In real, nothing is being saved
The code that updates the fields in the files is

MOVE 'C' TO ATT-LAST-CHG-ACT
CALL 'ATTIO' USING ATTORNEY-RECORD
ATT-IO-WS
REWRITE-CODE

The above code should update the changes but is not updating the data.


Any help
Sonia
 
Hi!

Too me it's looks like a call to a submodule called 'ATTIO', you have to check what it makes. Maybe there should be a value in parameter REWRITE-CODE

//Renaldini
 
In the submodule called 'ATTIO' It is

1400-REWRITE.
REWRITE ATTORNEY-RECORD
INVALID KEY MOVE 'I' TO WORK-BYTE.

OTHER THING IS THAT I HAVE OPENED THE FILES AFTER THIS STATEMENT SAY

1600-OPENIN.
OPEN INPUT ATTORNEY-FILE.
1700-OPENOUT.
OPEN OUTPUT ATTORNEY-FILE.
1800-OPENIO.
OPEN I-O ATTORNEY-FILE.
1900-CLOSE.
CLOSE ATTORNEY-FILE.

THE FILES ARE BEING OPENED AFTER READ, WRITE STATEMENTS. IT IS ADDING THE ATTORNEY SUCCESSFULLY BUT NOT UPDATING



THANKS
SONIA

 
You should be getting a return code from ATTIO which tells you why it is not updating. This should give you a clue.

Or else, look at the data which you are passing to ATTIO. Does it include the new attorney? Make sure that it does.

Nina Too
 
It happens like when I run the project it opens the "Attorney Maintenance" form. I always have to enter Attorney ID of 123456789 then it displays me attorneys within that attorney id in the List box. If I enter some other Attorney Id say 123455555 etc, it gives me error. The screen flicks for some time and then i get the error message"Combo box is not created". Sometimes system hangs if I do so.

Now if I am adding 123456789 and get the list of different attornies. I can click the "Add Attorney" Button and Attorney Detail form opens.There I can add the new attorney and PRESS THE "APPLY" button the code that runs is

IF ADD-ATTORNEY
IF ATT-OK
DISPLAY "ATT-OK"
DISPLAY "ATT-OK AND ADD-ATTORNEY"
MOVE 'C' TO ACTION-FLAG
CALL WOWSETPROP USING WIN-RETURN DETAIL-STATUS-H
'CURSECTION' 0
'SECTIONSTATUS' 'Attorney Added'.

This code runs fine as it adds the new attorney.

Now say I am on "Attorney Maintenance" form again and Click the "Attorney Detail Button" after highlighting some Attorney. It Takes me to ATTORNEY DETAIL form with the values os the Attorney I just highlighted and now when I update something in any field and again "PRESS THE APPLY " button, it gives no error message but also does not save the updated data also. Here the code that runs is

IF CHANGE-ATTORNEY
IF NOT ATT-OK
DISPLAY "NOT ATT-OK AND ADD-ATTORNEY"
MOVE 'A' TO ACTION-FLAG
CALL WOWSETPROP USING WIN-RETURN DETAIL-STATUS-H
'CURSECTION' 0
'SECTIONSTATUS' 'Attorney Updated'.

In this code I wrote the display statement which shows that this code is executed but why it does not update.

Thanks



 
In this code:

IF CHANGE-ATTORNEY
IF NOT ATT-OK
DISPLAY "NOT ATT-OK AND ADD-ATTORNEY"
MOVE 'A' TO ACTION-FLAG
CALL WOWSETPROP USING WIN-RETURN DETAIL-STATUS-H
'CURSECTION' 0
'SECTIONSTATUS' 'Attorney Updated'.



Your code only does something if your 88 switch is not ATT-OK. It will display the error message, then will go ahead and move the 'A' to the ACTION-FLAG and call WOWSETPROP and do whatever processing WOWSETPROP does.

If ATT-OK, you do absolutely nothing.

I think that, instead, you want:

IF CHANGE-ATTORNEY
IF NOT ATT-OK
DISPLAY "NOT ATT-OK AND ADD-ATTORNEY"

ELSE
MOVE 'A' TO ACTION-FLAG
CALL WOWSETPROP USING WIN-RETURN DETAIL-STATUS-H
'CURSECTION' 0
'SECTIONSTATUS' 'Attorney Updated'

END-IF
END-IF.


Better yet, I would get rid of the negative logic and code it:

IF CHANGE-ATTORNEY
IF ATT-OK
MOVE 'A' TO ACTION-FLAG
CALL WOWSETPROP USING WIN-RETURN DETAIL-STATUS-H
'CURSECTION' 0
'SECTIONSTATUS' 'Attorney Updated'
ELSE
DISPLAY "NOT ATT-OK AND ADD-ATTORNEY"
END-IF
END-IF.


I always use END-IF to delimit any IF statement. That way, I don't get confused as to what is being done under which conditions. And with nested IF's, you just about have to use END-IF to delimit.

Hope this helps, Nina Too
 
Here is the code for ATTIO file

ID DIVISION.
PROGRAM-ID. ATTIO.
AUTHOR. LCS.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OPTIONAL ATTORNEY-FILE
ASSIGN TWO DISK 'ATTFILE'
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS ATT-ATTORNEY-KEY
ALTERNATE RECORD KEY IS ATT-NAME WITH DUPLICATES
FILE STATUS IS ATT-STATUS.
DATA DIVISION.
FILE SECTION.
FD ATTORNEY-FILE
LABEL RECORDS ARE STANDARD
COPY ATTREC.
WORKING-STORAGE SECTION.
COPY STDIOCOD.
01 WORK-BYTE PIC X.
LINKAGE SECTION.
01 RECORD-PASS-AREA PIC X(207).
COPY ATTWS.
01 PASSED-BYTE PIC X.
PROCEDURE DIVISION USING RECORD-PASS-AREA
ATT-IO-WS
PASSED-BYTE.
0100-MAINLINE SECTION.
0200-MAINLINE.
MOVE SPACE TO WORK-BYTE.
MOVE RECORD-PASS-AREA TO ATTORNEY-RECORD.
IF PASSED-BYTE = READ-CODE
PERFORM 1100-READ
ELSE
IF PASSED-BYTE = RNEXT-CODE
PERFORM 1200-RNEXT
ELSE
IF PASSED-BYTE = WRITE-CODE
PERFORM 1300-WRITE
ELSE
IF PASSED-BYTE = REWRITE-CODE
PERFORM 1400-REWRITE
ELSE
IF PASSED-BYTE = START-CODE
PERFORM 1500-START
ELSE
IF PASSED-BYTE = OPEN-IN-CODE
PERFORM 1600-OPENIN
ELSE
IF PASSED-BYTE = OPEN-OUT-CODE
PERFORM 1700-OPENOUT
ELSE
IF PASSED-BYTE = OPEN-IO-CODE
PERFORM 1800-OPENIO
ELSE
IF PASSED-BYTE = CLOSE-CODE
PERFORM 1900-CLOSE
ELSE
IF PASSED-BYTE = DELETE-CODE
PERFORM 2000-DELETE
ELSE
IF PASSED-BYTE = STARTA-CODE
PERFORM 2100-STARTA
ELSE
IF PASSED-BYTE = UNLOCK-CODE
PERFORM 2200-UNLOCK.
IF ATT-OK
MOVE ATTORNEY-RECORD TO RECORD-PASS-AREA.
GOBACK.
1100-READ.
READ ATTORNEY-FILE RECORD
INVALID KEY MOVE 'I' TO WORK-BYTE.
1200-RNEXT.
READ ATTORNEY-FILE NEXT RECORD
AT END KEY MOVE 'E' TO WORK-BYTE.
1300-WRITE.
WRITE ATTORNEY-RECORD
INVALID KEY MOVE 'I' TO WORK-BYTE.
1400-REWRITE.
REWRITE ATTORNEY-RECORD
INVALID KEY MOVE 'I' TO WORK-BYTE.
1500-START.
START ATTORNEY-FILE

KEY IS NOT LESS THAN ATT-ATTORNEY-KEY
INVALID KEY MOVE 'I' TO WORK-BYTE.
1600-OPENIN.
OPEN INPUT ATTORNEY-FILE.
1700-OPENOUT.
OPEN OUPUT ATTORNEY-FILE.
1800-OPENIO.
OPEN I-O ATTORNEY-FILE.
1900-CLOSE.
CLOSE ATTORNEY-FILE.
2000-DELETE.
DELETE ATTORNEY-FILE RECORD
INVALID KEY MOVE 'I' TO WORK-BYTE.
2100-STARTA.
START ATTORNEY-FILE

KEY IS NOT LESS THAN ATT-NAME
INVALID KEY MOVE 'I' TO WORK-BYTE.

2200-UNLOCK.
UNLOCK ATTORNEY-FILE RECORD.











 
Hi Nina

You were write, I made the changes but still the problem is exactly the same. It does show me 'Attorney Update'message in the status bar because of the following code:
IF CHANGE-ATTORNEY
IF ATT-OK
MOVE 'A' TO ACTION-FLAG
CALL WOWSETPROP USING WIN-RETURN DETAIL-STATUS-H
'CURSECTION' 0
'SECTIONSTATUS' 'Attorney Updated'
ELSE
DISPLAY "NOT ATT-OK AND ADD-ATTORNEY"
END-IF
END-IF.



But does not update the record. It just give me the wrong information

Thanks
sonia
 
I think now you will have to look at the following section:

MOVE 'A' TO ACTION-FLAG
CALL WOWSETPROP USING WIN-RETURN DETAIL-STATUS-H
'CURSECTION' 0
'SECTIONSTATUS' 'Attorney Updated'


For whatever reason, your WOWSETPROP program isn't doing the update. You need to look at its return code and see why it isn't doing the update. Only if it's return code = '0' should you get the 'Attorney Updated' message.

Nina Too
 
You cannot read a record until the file is opened. You cannot write or re-write a cord unless the file is open. You must open your files before you attempt any other I/O.

Stephen J Spiro
Member, J4 COBOL Standards Committee
check it out at

stephenjspiro at hotmail.com
 
you were right Stephen in saying that 'You cannot read a record until the file is opened. You cannot write or re-write a cord unless the file is open. You must open your files before you attempt any other I/O'. That is what I thought and cut and pasted the following statements after the 0100-MAINLINE SECTION.

1600-OPENIN.
OPEN INPUT ATTORNEY-FILE.
1700-OPENOUT.
OPEN OUPUT ATTORNEY-FILE.
1800-OPENIO.
OPEN I-O ATTORNEY-FILE.


When I did that it gives me the error message
'mtattrny' terminated with return code 255.
COBOL error code: 41,02'

This error means: A duplicate open was rejected by a system which does not allow the COBOL file name to be opened twice


Even though I have deleted the open commands at the end and pasted them in the beginning .

Thanks
sonia
 
Sonia, the file must have been opened in the CALLing program, so that was not the source of your problem. Put the code back! Sorry, but that is what happens when we only have part of the code in front of us.

For a REWRITE, you must have the key of the record in the primary key, ATT-ATTORNEY-KEY. Otherwise, you are "updating" a record with a key of garbage.
You must add a line of code in 1400-REWRITE to move the key from the field in LINKAGE to the field in the FD.

Stephen J Spiro
Member, J4 COBOL Standards Committee
check it out at

stephenjspiro at hotmail.com
 
Hi,

Thx for your reply.When fields for new attorney are written.They are saved but when changes are made then is there need of moving the fields.
I entered this code in 1400-Rewrite stmt but again no change is saved.

MOVE RECORD-PASS-AREA TO ATTORNEY-RECORD




Is there some error in coding of Apply Button.Apply button when clicked saves change for New Attorney.
Thx
Sonia
 
I REALLY REALLY hate debugging a system when all I see are snippets of code. Not only can I not see the calling program, the copybooks are not expanded.
*--------------------------
You enter this program multiple times. Each time you enter it, it is in LAST USED state.
Start putting DISPLAY statements all over the place. When you enter the program, DISPLAY each of the linkage fields. DISPLAY what is in the File Record. Where do you see the correct data? What is in your program before you rewrite? Give us (and yourself) some help here.

Stephen J Spiro
Member, J4 COBOL Standards Committee
check it out at

stephenjspiro at hotmail.com
 
Do you have a debugging tool where you can go through the program step-by-step? Most online systems provide for debugging tools.

If you do have one, then go through both the calling program and the called program step by step. This is tedious but it has to be done. Look at the values which appear in your debugging tool. Especially look at any values involved in your update/rewrite process. Find out what return code you are getting when you attempt the rewrite.

If your return code indicates that you are trying to open the file twice (as you said it was doing before), then step through all steps involved with anytime the program opens the file. You might have to check the open status when you do your rewrite.

But above all, you have to find out the return code that is specifically involved with your rewrite. It has to be greater than 0. Find out what it is, then fix that problem.

Nina Too
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top