Hi guys,
I am working on a new program that will format 8192 record length of data in to 90 byte lines. This line can occurs up to 150 line max. Below is the logic that i have came upon.
I have defined two tables: -
*
01 TABLE.
05 WS-TABLE-DATA OCCURS 150 TIMES.
10 WS-LINE OCCURS 90 TIMES.
15 WS-DATA PIC X.
*
01 WS-TOT-DATA.
05 WS-TOT-DATA-REC OCCURS 8192 TIMES.
10 WS-DATA-TOT PIC X.
*****************************************************************
PERFORM VARYING WS-LINE-CNT FROM 1 BY 1 UNTIL
WS-LINE-CNT > WS-LINES
PERFORM VARYING WS-CHAR-CNT FROM 1 BY 1 UNTIL
WS-CHAR-CNT > 90
MOVE WS-DATA-TOT(S)
TO WS-DATA(WS-LINE-CNT WS-CHAR-CNT)
IF S = L
MOVE 90 TO WS-CHAR-CNT
END-IF
ADD +1 TO S
END-PERFORM
END-PERFORM.
before this logic i am calculating the actual length(L) of the record 8192(Which is variable in nature). And then calculating the numbers of line needed by dividing actual length with 90.
Today i was again asked that this logic should print line based on words i.e if the above perform loop executes and it detect that the last byte(90th) position is not empty then it will assume that there is a continuation of a word and it should start with the next line. Example below
-----------------7----+----8----+----9
......this is a test line is an continuation.
the above logic will print - ......this is a line is an continua
New line - tion
it should print - .........this is a test line is an
New line - continuation.
I would like to know how we can handle this situation. please let me know your views.
Thank you for your time ...
Regards
Anand