Having trouble with my lines in COBOL -
i having little issue cannot solve. lines showing wrong on output. example have line suppose show this:
123-45-6789 j s doe second yr programming 88 266 3.02
but instead showing this:
123-45-6789 j s doe second yr programming 88 266
3.02
anyone know how fix this. have never encountered problem before.
here storage area lines
01 detail-line. 05 dl-first-num pic x(3). 05 dl-dash-1 pic x value '-'. 05 dl-second-num pic xx. 05 dl-dash-2 pic x value '-'. 05 dl-third-num pic x(4). 05 blank-a-out pic x(3) value spaces. 05 dl-first-letter pic x. 05 blank-b-out pic x value spaces. 05 dl-second-letter pic x. 05 blank-c-out pic x value spaces. 05 dl-last-name pic x(9). 05 blank-d-out pic x(2) value spaces. 05 dl-class-standing pic x(9). 05 blank-e-out pic x(3) value spaces. 05 dl-major pic x(13). 05 blank-f-out pic x(3) value spaces. 05 dl-hours pic zz9. 05 blank-g-out pic x(5) value spaces. 05 dl-points pic zz9. 05 blank-h-out pic x(4) value spaces. 05 dl-gpa pic 9.99. and here code write out
400-process-one-record. if line-count >= 52 perform 600-next-page end-if add 2 line-count move ssn-in ssn-break move first-num dl-first-num move second-num dl-second-num move third-num dl-third-num move student-name-in name-break move first-letter dl-first-letter move second-letter dl-second-letter move last-name dl-last-name if class-standing-in = 0 move 'high school' dl-class-standing end-if if class-standing-in = 1 move 'first yr' dl-class-standing end-if if class-standing-in = 2 move 'second yr' dl-class-standing end-if if class-standing-in = 3 move 'program 60' dl-class-standing end-if if class-standing-in = ' ' or 4 move ' ' dl-class-standing end-if if major-in = 'nes' move 'net security' dl-major end-if if major-in = 'net' move 'networking' dl-major end-if if major-in = 'pgm' move 'programming' dl-major end-if if major-in = 'dig' move 'digital media' dl-major end-if if major-in = 'cor' move ' ' dl-major end-if move credit-hours-in dl-hours if major-in = 'nes' add 1 nes-total end-if if major-in = 'net' add 1 net-total end-if if major-in = 'pgm' add 1 pgm-total end-if if major-in = 'dig' add 1 dig-total end-if move credit-points-in dl-points compute total-gpa rounded = credit-points-in / credit-hours-in if major-in = 'nes' , total-gpa > '3.o' add 1 nes-gpa end-if if major-in = 'net' , total-gpa > '3.o' add 1 net-gpa end-if if major-in = 'pgm' , total-gpa > '3.o' add 1 pgm-gpa end-if if major-in = 'dig' , total-gpa > '3.o' add 1 dig-gpa end-if move total-gpa dl-gpa move detail-line students-record-out if dl-class-standing = 'first yr' or 'second yr' , grad-stat-in = ' ' or 'x' add credit-points-in total-points add credit-hours-in total-hours write students-record-out after advancing 1 lines end-if.
there couple of possible explanations line break.
the first explanation eliminate line wrapping caused whatever device displaying output on. based on detail-line record layout have provided, wrap occurs @ column 72. suspicious. output device (eg. screen, or file) wrap lines @ column 72
the next possible explanation involves non-space character, such line feed, stored in blank-h-out. may have happened through number of programming goofs elsewhere in program. unchecked out of bounds array/table references source of sort of thing. working out take real debugging.
Comments
Post a Comment