Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Write Statement | Confusion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Mon Jul 13, 2009 4:34 pm    Post subject: Write Statement | Confusion
Reply with quote

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
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jul 13, 2009 5:14 pm    Post subject: Re: Write Statement | Confusion
Reply with quote

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
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Mon Jul 13, 2009 6:17 pm    Post subject: Reply to: Write Statement | Confusion
Reply with quote

Deleted because of duplicates...
restored because of multitasking icon_biggrin.gif

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7996
Location: Bellevue, IA

PostPosted: Mon Jul 13, 2009 6:37 pm    Post subject:
Reply with quote

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
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Mon Jul 13, 2009 6:49 pm    Post subject: Reply to: Write Statement | Confusion
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7996
Location: Bellevue, IA

PostPosted: Mon Jul 13, 2009 7:01 pm    Post subject:
Reply with quote

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. icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Jul 13, 2009 7:11 pm    Post subject:
Reply with quote

PS. There are just 6-letters in Robert, what's the big deal in typing 3 more... icon_rolleyes.gif
Back to top
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Mon Jul 13, 2009 9:59 pm    Post subject: Reply to: Write Statement | Confusion
Reply with quote

Rob.. Ooops Robert you did the job... icon_biggrin.gif

Thanks..
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Write R1 and R2 to OP1 and R1 to OP2 bhaskar_kanteti DFSORT/ICETOOL 10 Fri Mar 03, 2017 11:18 am
No new posts Can you write 2 recs on SORTOUT when ... Sysaron DFSORT/ICETOOL 6 Thu Feb 23, 2017 12:07 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us