View previous topic :: View next topic
|
Author |
Message |
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Code: |
557600 YB-WRITE-STBLOAD SECTION. DBGP780
557700************************************************************** CL*55
557800* WRITE RECORD FOR STBLDING TO DB *
557900************************************************************** CL*55
558000 DBGP780
558100 MOVE SG-NOT-TYP-CODE OF R5030-SG-NOT-TYP DBGP780
558200 TO STBLD-NOTICE-TYPE.
558300*SK1 DBGP780
558310 DISPLAY 'IN YB B4 WRT - STBLD-NOTICE-TYPE' STBLD-NOTICE-TYPE
558320 DISPLAY 'IN YB B4 WRT - LOAD-NOTICE-TYPE ' LOAD-NOTICE-TYPE
558400 WRITE STBLD-RECORD.
558410 DISPLAY 'IN YB AF WRT - STBLD-NOTICE-TYPE' STBLD-NOTICE-TYPE
558420 DISPLAY 'IN YB AF WRT - LOAD-NOTICE-TYPE ' LOAD-NOTICE-TYPE
558500 DBGP780
558600 ADD 1 TO CN-RECORDS-ADDED. CL*39
558700 DBGP780
558800 YB99-EXIT. DBGP780
558900 EXIT. DBGP780
559000 EJECT DBGP780
|
The value in the variable "STBLD-NOTICE-TYPE"is moved to "LOAD-NOTICE-TYPE" and written into another file.
So in production the values in the variables are same so the values in the output files are same. But, in while testing
Output in both the files are different as after a write statement the value in "STBLD-NOTICE-TYPE" is " "
Only after the above code value in the variable "STBLD-NOTICE-TYPE"is moved to "LOAD-NOTICE-TYPE"
Code: |
Expected
IN YB B4 WRT - STBLD-NOTICE-TYPE027
IN YB B4 WRT - LOAD-NOTICE-TYPE 000
IN YB AF WRT - STBLD-NOTICE-TYPE000
IN YB AF WRT - LOAD-NOTICE-TYPE 000
In Prod
IN YB B4 WRT - STBLD-NOTICE-TYPE027
IN YB B4 WRT - LOAD-NOTICE-TYPE 000
IN YB AF WRT - STBLD-NOTICE-TYPE027
IN YB AF WRT - LOAD-NOTICE-TYPE 000
Testing
IN YB B4 WRT - STBLD-NOTICE-TYPE027
IN YB B4 WRT - LOAD-NOTICE-TYPE 000
IN YB AF WRT - STBLD-NOTICE-TYPE000
IN YB AF WRT - LOAD-NOTICE-TYPE 000
|
Can someone help me in understanding why this is happening. Am i going wrong somewhere. I am using the same code in Production. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Code: |
LOAD-NOTICE-TYPE
STBLD-NOTICE-TYPE |
Are these fields defined in the FD entry. If they are their value is undefined after the write statement. |
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Deleted because of duplicates...
restored because of multitasking
Hi,
Many thanks for the reply
This is the FD section. I have not changed anything from the job that is run in production.
Code: |
020400 FD STBLOAD DBGP780
020500 RECORDING MODE IS V DBGP780
020600 BLOCK CONTAINS 0 RECORDS DBGP780
020700 LABEL RECORDS STANDARD. DBGP780
021300 01 STBLD-RECORD.
021400 03 STBLD-NOTICE-TYPE PIC 9(3) COMP.
021500 88 STBLD-CCJ VALUE 1 7 9 .
021600 88 STBLD-LTD VALUE 15 19 23 25 27 29
021700 31 35 37 39
021800 55 57 61 63 65 71
021900 73 75 79 81 85 87
022000 89.
022100 88 STBLD-BANKRUPT VALUE 3 4 11 21 41 59 77 .
022200 88 STBLD-DECREE VALUE 51 53 67 69 .
022300 88 STBLD-CRED VALUE 17.
022400 03 STBLD-HEADING-TYPE PIC 9(3) COMP.
022500 03 STBLD-RECORD-LENGTH PIC S9(4) COMP.
022600 03 STBLD-STB-RECORD.
022700 05 FILLER PIC X
022800 OCCURS 0 TO 1444 TIMES DEPENDING ON STBLD-RECORD-LENGTH.
027100 FD STUBBSLD
027200 RECORDING MODE IS V
027300 BLOCK CONTAINS 0 RECORDS
027400 LABEL RECORDS OMITTED.
027500
027700 COPY STBLDDT.
Contents of STBLDDT copybook:
000200 01 LOAD-RECORD.
000210 03 LOAD-NOTICE-TYPE PIC 9(3) COMP.
000220 88 LOAD-CCJ VALUE 1 7 9 .
000230 88 LOAD-LTD VALUE 15 19 23 25 27 29
000240 31 35 37 39
000250 55 57 61 63 65 71
000260 73 75 79 81 85 87
000270 89.
000280 88 LOAD-BANKRUPT VALUE 3 4 11 13 21 41 59 77.
000290 88 LOAD-DECREE VALUE 51 53 67 69 .
000290 88 LOAD-CRED VALUE 17.
000300 03 LOAD-HEADING-TYPE PIC 9(3) COMP.
03 LOAD-SEQ PIC S9(9) COMP.
000210 03 LOAD-SUB-TYPE PIC 9.
000220 88 LOAD-NOTICE VALUE 1.
000220 88 LOAD-TEXT VALUE 2.
000220 88 LOAD-CRLIST VALUE 3.
03 LOAD-DUNS-NUMBER PIC X(9).
03 LOAD-COMM-RECYC-IND PIC X.
00028 03 LOAD-RECORD-LENGTH PIC 9(3) COMP.
000320 03 LOAD-STB-RECORD.
000330 05 FILLER PIC X
00031 OCCURS 0 TO 844 TIMES DEPENDING ON LOAD-RECORD-LENGTH.
|
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
From the COBOL Language Reference manual, section 6.1.8.9.3:
Quote: |
After the execution of the RELEASE, REWRITE or WRITE statement is complete, the information in the area referenced by identifier-1 is available even though the information in the area referenced by record-name-1 is unavailable, except as specified by the SAME RECORD AREA clause. |
If you do not have SAME RECORD AREA specified in your ASSIGN clause, access to any of the variables in the 01 for the FD after a WRITE statement will have unpredictable results. You are attempting to DISPLAY a field under the FD record 01 after a WRITE, so your results are unpredictable. They are what they are. Accept it, stop attempting to DISPLAY after writing data, and go on. |
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Thanks for that Rob. But, i am trying to run the job, STBLD-NOTICE-TYPE field is getting populated as expected in the output file but the LOAD-NOTICE-TYPE is populated with zeroes. Thats not the case in production though! Any suggestions to overcome it? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Basically, if you're not moving from the FD 01 level before the WRITE, the behavior in production may reflect the unpredictable nature of handling the buffer after a WRITE statement. I would not expect you to have access to any of the data in the buffer (the FD 01) after a WRITE statement, so your statement that this is happening in production surprises me. You want to ensure the data is moved before the WRITE, period.
And, by the way, I go by Robert -- not Rob. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
PS. There are just 6-letters in Robert, what's the big deal in typing 3 more... |
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Rob.. Ooops Robert you did the job...
Thanks.. |
|
Back to top |
|
|
|