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
 

 

Output file not getting populated in correct format

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

New User


Joined: 14 Mar 2012
Posts: 69
Location: India

PostPosted: Tue Apr 29, 2014 12:24 pm    Post subject: Output file not getting populated in correct format
Reply with quote

Hi,
I am writing a cobol program where it reads the current and previous generation of GDG and then writing the changed record( either updated, new or deleted) records to the output flat file and also it is updating the VSAM file.

The details are:
1. Two input files- GDGs with current and prev generations
2. One output flat file
3. One I-O VSAM file


The layout of the output flat file and I-O VSAM files are same. The layout of the input and output files are different.

when my program is getting executed, the records of the Output flat file is not getting populated properly. I am getting incorrect values.

The output flat file and I-O VSAM flat record layout are like below-
Code:

*01  ITEM-XTRACT-RECORD.
     05 :PRFX:ITEM-NBR-GRP.
        10 :PRFX:ITEM-TB                  PIC  9(02).
        10 :PRFX:ITEM-NBR                 PIC  9(05).
     05 FILLER                            PIC  X(01).
     05 :PRFX:UNIQ-ITEM-NBR               PIC  9(06).
     05 :PRFX:UNIQ-ITEM-NBR-CHNG-DATE     PIC  X(08).
     05 FILLER                            PIC  X(01).
     05 :PRFX:GTIN.
        10 :PRFX:UPC-NBR                  PIC  9(13).
        10 :PRFX:UPC-CHK-DIGIT            PIC  9(01).
     05 :PRFX:GTIN-CHNG-DATE              PIC  X(08).
     05 FILLER                            PIC  X(01).
     05 :PRFX:CURR-ITEM-STATUS            PIC  9(01).
        88 :PRFX:ITEM-ACTIVE                   VALUE 0.
        88 :PRFX:ITEM-TEMP-OUT                 VALUE 1.
        88 :PRFX:ITEM-DISCOED-WHEN-OUT         VALUE 2.
        88 :PRFX:ITEM-DISCOED                  VALUE 3.
        88 :PRFX:ITEM-NEW                      VALUE 4.
        88 :PRFX:ITEM-SUSPEND-WHEN-OUT         VALUE 5.
        88 :PRFX:ITEM-SUSPEND                  VALUE 6.
     05 FILLER                            PIC  X(01).
     05 :PRFX:ITEM-STATUS-CHNG-DATE.
        10 :PRFX:ACTIVE-STATUS-DATE       PIC  X(08).
        10 :PRFX:TEMPOUT-STATUS-DATE      PIC  X(08).
        10 :PRFX:DWO-STATUS-DATE          PIC  X(08).
        10 :PRFX:DISCOED-STATUS-DATE      PIC  X(08).
        10 :PRFX:NEW-STATUS-DATE          PIC  X(08).
        10 :PRFX:SWO-STATUS-DATE          PIC  X(08).
        10 :PRFX:SUSPEND-STATUS-DATE      PIC  X(08).
     05 FILLER                            PIC  X(01).
     05 :PRFX:ITEM-DROPPED-DATE           PIC  X(08).
     05 FILLER                            PIC  X(37).


The input layout is as follows(i am only pasting the layout from start to the point which is used in output, rest i am not pasting here)
Code:

*01  :PRFX:ITEM-XTRACT-RECORD.
     05 :PRFX:ITEM-NBR-GRP.
        10 :PRFX:ITEM-TB                  PIC  9(02).
        10 :PRFX:ITEM-NBR                 PIC  9(05).
        10 :PRFX:ITEM-DEAL-CD             PIC  9(01).
     05 :PRFX:UNIQ-ITEM-NBR               PIC  9(06).
     05 :PRFX:GTIN.
        10 :PRFX:UPC-NBR                  PIC  9(13).
        10 :PRFX:UPC-CHK-DIGIT            PIC  9(01).
     05 :PRFX:ITEM-STATUS-CD              PIC  9(01).
        88 :PRFX:ITEM-ACTIVE                   VALUE 0.
        88 :PRFX:ITEM-TEMP-OUT                 VALUE 1.
        88 :PRFX:ITEM-DISCOED-WHEN-OUT         VALUE 2.
        88 :PRFX:ITEM-DISCOED                  VALUE 3.
        88 :PRFX:ITEM-NEW                      VALUE 4.
        88 :PRFX:ITEM-SUSPEND-WHEN-OUT         VALUE 5.
        88 :PRFX:ITEM-SUSPEND                  VALUE 6.


My write para of source program is like below-
Code:

 2300-WRITE-OUT-PARA.
*-----------------------*
     MOVE '2300-WRITE-OUT-PARA'       TO WS-PARANAME
D    DISPLAY WS-PARANAME

        MOVE WSCUR-ITEM-TB       TO WSCHG-ITEM-TB
        MOVE WSCUR-ITEM-NBR      TO WSCHG-ITEM-NBR
        MOVE WSCUR-UNIQ-ITEM-NBR TO WSCHG-UNIQ-ITEM-NBR
        MOVE WSCUR-GTIN          TO WSCHG-GTIN
        MOVE SPACES              TO WSCHG-ITEM-DROPPED-DATE
        MOVE WSCUR-ITEM-STATUS-CD TO WSCHG-CURR-ITEM-STATUS

        IF WSPRV-UNIQ-ITEM-NBR    NOT = WSCUR-UNIQ-ITEM-NBR
        MOVE WS-CURRENT-DATE TO WSCHG-UNIQ-ITEM-NBR-CHNG-DATE
        ELSE
        MOVE SPACES          TO WSCHG-UNIQ-ITEM-NBR-CHNG-DATE
        END-IF

        IF WSPRV-GTIN    NOT = WSCUR-GTIN
        MOVE WS-CURRENT-DATE TO WSCHG-GTIN-CHNG-DATE
        ELSE
        MOVE SPACES          TO WSCHG-GTIN-CHNG-DATE
        END-IF

        IF WSPRV-ITEM-STATUS-CD  NOT = WSCUR-ITEM-STATUS-CD
           EVALUATE WSCUR-ITEM-STATUS-CD
               WHEN 0 MOVE WS-CURRENT-DATE
                   TO WSCHG-ACTIVE-STATUS-DATE
               WHEN 1 MOVE WS-CURRENT-DATE
                   TO WSCHG-TEMPOUT-STATUS-DATE
               WHEN 2 MOVE WS-CURRENT-DATE
                   TO WSCHG-DWO-STATUS-DATE
               WHEN 3 MOVE WS-CURRENT-DATE
                   TO WSCHG-DISCOED-STATUS-DATE
               WHEN 4 MOVE WS-CURRENT-DATE
                   TO WSCHG-NEW-STATUS-DATE
               WHEN 5 MOVE WS-CURRENT-DATE
                   TO WSCHG-SWO-STATUS-DATE
               WHEN 6 MOVE WS-CURRENT-DATE
                   TO WSCHG-SUSPEND-STATUS-DATE
           END-EVALUATE
        ELSE
           EVALUATE WSCUR-ITEM-STATUS-CD
               WHEN 0 MOVE SPACES
                   TO WSCHG-ACTIVE-STATUS-DATE
               WHEN 1 MOVE SPACES
                   TO WSCHG-TEMPOUT-STATUS-DATE
               WHEN 2 MOVE SPACES
                   TO WSCHG-DWO-STATUS-DATE
               WHEN 3 MOVE SPACES
                   TO WSCHG-DISCOED-STATUS-DATE
               WHEN 4 MOVE SPACES
                   TO WSCHG-NEW-STATUS-DATE
               WHEN 5 MOVE SPACES
                   TO WSCHG-SWO-STATUS-DATE
               WHEN 6 MOVE SPACES
                   TO WSCHG-SUSPEND-STATUS-DATE
           END-EVALUATE
        END-IF

     WRITE WSCHG-ITEM-XTRACT-RECORD FROM
                         WSCUR-ITEM-XTRACT-RECORD
     ADD   1       TO WS-OUTCHITF-REC-WRITE

     .
 2300-WRITE-OUT-EXIT.
*-----------------------*
      EXIT.


The input file layout from fileaid-


:PRFX:ITEM-TB :PRFX:ITEM-NBR :PRFX:ITEM-DEAL-CD :PRFX:UNIQ-ITEM-NBR
2/NUM 5/NUM 1/NUM 6/NUM
(1-2) (3-7) (8-8) (9-14)
2------------ 3------------- 4----------------- 5------------------
********************************* TOP OF DATA **********************-CAPS OFF-*
- - - - - - - - - - - - - - - - - - - - - - - - - 44370 RECORD(S) NOT SELECTED
1 66944 0 166944
- - - - - - - - - - - - - - - - - - - - - - - - - 212246 RECORD(S) NOT SELECTED

:PRFX:UPC-NBR :PRFX:UPC-CHK-DIGIT :PRFX:ITEM-STATUS-CD :PRFX:CATEGORY
13/NUM 1/NUM 1/NUM 5/AN
(15-27) (28-28) (29-29) (30-34)
7------------ 8------------------ 9------------------- 10------------
********************************* TOP OF DATA **********************-CAPS OFF-*
- - - - - - - - - - - - - - - - - - - - - - - - - 44370 RECORD(S) NOT SELECTED
5210000810 3 3 15400
- - - - - - - - - - - - - - - - - - - - - - - - - 212246 RECORD(S) NOT SELECTED

The problem is that my ouput flat file is not getting populated properly-
Code:

:PRFX:ITEM-TB :PRFX:ITEM-NBR FILLER   :PRFX:UNIQ-ITEM-NBR
2/NUM         5/NUM          1/AN     6/NUM
(1-2)         (3-7)          (8-8)    (9-14)
2------------ 3------------- 4------- 5------------------
********************************* TOP OF DATA **********************-CAPS OFF-*
            1          66944 0                     166944
- - - - - - - - - - - - - - - - - - - - - - - - - - - 24 RECORD(S) NOT SELECTED
:PRFX:UNIQ-ITEM-NBR-CHNG-DATE FILLER   :PRFX:UPC-NBR :PRFX:UPC-CHK-DIGIT
8/AN                          1/AN     13/NUM        1/NUM
(15-22)                       (23-23)  (24-36)       (37-37)
6---------------------------- 7------- 9------------ 10-----------------
********************************* TOP OF DATA **********************-CAPS OFF-*
00052100                      0         810331540015                   4
- - - - - - - - - - - - - - - - - - - - - - - - - - - 24 RECORD(S) NOT SELECTED
:PRFX:GTIN-CHNG-DATE FILLER   :PRFX:CURR-ITEM-STATUS FILLER
8/AN                 1/AN     1/NUM                  1/AN
(38-45)              (46-46)  (47-47)                (48-48)
11------------------ 12------ 13-------------------- 14------
********************************* TOP OF DATA **********************-CAPS OFF-*
09MC GRO             U        INVALID                D
- - - - - - - - - - - - - - - - - - - - - - - - - - - 24 RECORD(S) NOT SELECTED
:PRFX:ACTIVE-STATUS-DATE :PRFX:TEMPOUT-STATUS-DATE :PRFX:DWO-STATUS-DATE
8/AN                     8/AN                      8/AN
(49-56)                  (57-64)                   (65-72)
16---------------------- 17----------------------- 18-------------------
********************************* TOP OF DATA **********************-CAPS OFF-*
 CUMIN                    MCRMK G                  ROUND CU
- - - - - - - - - - - - - - - - - - - - - - - - - - - 24 RECORD(S) NOT SELECTED
:PRFX:DISCOED-STATUS-DATE :PRFX:NEW-STATUS-DATE :PRFX:SWO-STATUS-DATE
8/AN                      8/AN                  8/AN
(73-80)                   (81-88)               (89-96)
19----------------------- 20------------------- 21-------------------
********************************* TOP OF DATA **********************-CAPS OFF-*
MIN                              0              00020{Z
- - - - - - - - - - - - - - - - - - - - - - - - - - - 24 RECORD(S) NOT SELECTED
:PRFX:SUSPEND-STATUS-DATE FILLER    :PRFX:ITEM-DROPPED-DATE FILLER
8/AN                      1/AN      8/AN                    37/AN
(97-104)                  (105-105) (106-113)               (114-133)
22----------------------- 23------- 24--------------------- 25------------------
********************************* TOP OF DATA **********************-CAPS OFF-*
    2 OZ                  0         00060000                10001B020002000G 000
FILLER
37/AN
(134-150)
25---------------
********************************* TOP OF DATA **********************-CAPS OFF-*
10023070000131100
- - - - - - - - - - - - - - - - - - - - - - - - - - - 24 RECORD(S) NOT SELECTED

though i am moving all the values from the input file, i am not getting the output file records correctly.
E.g Filler is having the value as 0, 1,2 etc instead of space
PRFX:UNIQ-ITEM-NBR-CHNG-DATE- Either it should be spaces or current system date but it is not getting populated correctly
PRFX:UPC-NBR- getting populated wrongly

Anyone Please help me on fixing this.
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Tue Apr 29, 2014 12:51 pm    Post subject:
Reply with quote

Why not to ADD DISPLAY before and after the MOVE statement and check what went wrong???


Also you might wants to check WRITE FROM WSCUR-ITEM-XTRACT-RECORD is what you want or WRITE FROM WSCHG-ITEM-XTRACT-RECORD
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Apr 29, 2014 7:47 pm    Post subject:
Reply with quote

I echo Rohit's comment -- you appear to be writing from the wrong 01 level; you keep moving data to WSCHG-??? but write from WSCUR-??? so first correct this issue and try the program again. If you are still having problems after that, we can help.
Back to top
View user's profile Send private message
sandeep kumar302

New User


Joined: 14 Mar 2012
Posts: 69
Location: India

PostPosted: Wed Apr 30, 2014 11:12 am    Post subject:
Reply with quote

Thanks Rohit and Robert, that was one of the error. Now based on Flag i am writing to the output files. My flags are defined as below-

01 WS-ITEM-STATUS-FLAG.
05 WS-NEW-ITEM-FLAG PIC X(01) VALUE 'N'.
05 WS-UPDATED-ITEM-FLAG PIC X(01) VALUE 'N'.
05 WS-DROPPED-ITEM-FLAG PIC X(01) VALUE 'N'.

My logic is that
IF WS-NEW-ITEM-FLAG = 'Y'
then i am writing to new item para
IF WS-UPDATED-ITEM-FLAG = 'Y'
then i am writing to update item para
If WS-DROPPED-ITEM-FLAG = 'Y'
then i am writing to drpped item para

everything is working fine but some records are getting repeated.

I guess the problem is with not Reseting the flag again to 'N'. If i am correct, can you please tell me how i can reset the flag to 'N'.

Is it simply Move 'N' to required flag
or set required flag to 'N'
or any other simple syntax is there?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Apr 30, 2014 11:26 am    Post subject:
Reply with quote

Sandeep, please use 88 level for set and reset of any flags as it is designed for that.

http://pic.dhe.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=%2Fcom.ibm.debugtool.doc_8.1%2Feqa8rm02224.htm

http://ibmmainframes.com/about1149.html
Back to top
View user's profile Send private message
sandeep kumar302

New User


Joined: 14 Mar 2012
Posts: 69
Location: India

PostPosted: Wed Apr 30, 2014 1:17 pm    Post subject:
Reply with quote

Thanks Rohit
But my doubt is that can we reset the flag using move i.e

IF WS-NEW-ITEM-FLAG = 'Y'
then i am writing to new item para
then again reset the flag to 'N' after the write is over

Can we do it through Move 'N' to flag

I have not tested it like this. just wondering if this is optimized way of reseting the flag or not after the move statement
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Wed Apr 30, 2014 1:20 pm    Post subject: Reply to: Output file not getting populated in correct forma
Reply with quote

Why have you not tested it? Why do you think that MOVEing a value to a standard variable will not work? Works every other time in your program, does it not?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Apr 30, 2014 1:21 pm    Post subject:
Reply with quote

If you use 88 level variable then just a SET statement would do as same as MOVE. So you do not additionally need any MOVE statement.

With what you have asked , Yes you can move it and give a try and let us know
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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