🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.cobol
Article #147

Re: Why isn't my program working?

#147
From: LX-i
Date: Mon, 28 Apr 2003 21:46
62 lines
3654 bytes
GoldenWing wrote:
> Im haveing some trouble with this program  after the SSN is written for the
> person,  it attempts to write part of the first name in what should be blank
> space.  Im not sure how to fix this.  I realize i am quite new to cobol but
> im trying to learn as best I can. Please Help.  Thanks

I've distilled this for you...

>        FD TAX-FILE-I.
>        01  TAX-REPORT.
>            02  I-SSN                PIC X(09).
>            02  I-NAME.
>                03  I-FIRST-NAME         PIC X(10).
>                03  I-LAST-NAME          PIC X(10).
>            02  I-TAX-INCOME         PIC 9(8)V9(2).
>            02  I-TAX-REFUND         PIC 9(8)V9(2).
>            02  FILLER               PIC X(31).

...

>        01  TAX-RECORD-O.
>           02  O-SSN                PIC X(11).
>           02  FILLER               PIC 9(04).
>           02  O-NAME               PIC X(20).
>           02  FILLER               PIC X(02) VALUE SPACES.
>           02  O-TAX-INCOME         PIC $$$,$$$,$$9.9(02).
>           02  FILLER               PIC X(04) VALUE SPACES.
>           02  O-TAX-REFUND         PIC $$$,$$$,$$9.9(02).
>           02  FILLER               PIC X(03) VALUE SPACES.
>           02  O-PERCENT            PIC Z9.99.
>           02  FILLER               PIC X     VALUE '%'.

...

>        300-PROCESS-REPORT.
>            READ    TAX-FILE-I   INTO TAX-RECORD-O
>                AT END MOVE 'Y'  TO EOF
>                    NOT AT END
>                    PERFORM 310-REPORT
>            END-READ.

...

>            WRITE PRINT-RECORD     FROM    TAX-RECORD-O.

When you Read .. Into (at least with my implementation), your FD does 
not get filled.  And, since you have a mismatch in how the file is 
described and how the working-storage variable is defined, you're 
getting the extra stuff from your read...into.  I would just do the 
"Read", then move the data from the I- record to the -O record (which 
looks like what you're doing anyway - just take the into clause off and 
see what happens.)


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~   /   \  /                Live from Montgomery, AL!     ~
~  /     \/       o                                       ~
~ /      /\   -   |       AIM:  LXi0007                   ~
~ _____ /  \      |    E-mail:  DanielJS "at" Knology.net ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remove NOSPAM to e-mail me...
Technical Details
Message-ID: <3EADA127.2090104@Knology.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
References: <vaqqbv2fb85p4b@corp.supernews.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d15b,61ba20b84bd2781
X-Google-Attributes: gid10d15b,public
X-Google-Thread: 10585b,61ba20b84bd2781
X-Google-Attributes: gid10585b,public
X-Google-Thread: f4f85,61ba20b84bd2781
X-Google-Attributes: gidf4f85,public
X-Google-ArrivalTime: 2003-04-28 14:46:48 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
From: LX-i <DanielJSNOSPAM@Knology.net>
Newsgroups: comp.lang.cobol,alt.cobol,fj.comp.lang.cobol
Subject: Re: Why isn't my program working?
Date: Mon, 28 Apr 2003 16:46:15 -0500
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <3EADA127.2090104@Knology.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02
X-Accept-Language: en-us, en
MIME-Version: 1.0
References: <vaqqbv2fb85p4b@corp.supernews.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@supernews.com
Lines: 63