[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference ilbbak::ibi_focus

Title:FOCUS, from INFORMATION BUILDERS
Moderator:ZAYIUS::BROUILLETTE
Created:Thu Feb 19 1987
Last Modified:Mon May 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:615
Total number of notes:1779

109.0. "Converting Fortran Carriage Control to <FF>'s" by AKOV88::BIBEAULT_B (Bob Bibeault, Corp Acct Plan &amp; Systems) Mon Aug 08 1988 16:08

    
    At Corporate Accounting Planning & Systems, we have had our share
    of frustrations with simple things like getting Focus reports to
    use standard formfeed characters. For as long as the report was
    not edited by another tool (say WPS or DECmail), the Fortran CC
    worked fine. But editing typically created a new file with Carriage
    Control CC which meant that the '1' in the left-most byte was treated
    as data rather than a formfeed character.
    
    We wanted the Focus to replace the '1' with a <FF> character but
    found no way to do this directly within Focus. (In Powerhouse, it's
    as simple as adding the directive SET FORMFEED to your report or
    initialization file).
    
    Initially we used an EDT routine to insert <FF> characters at page
    breaks but found this method too inefficient and report-specific.
    
    I finally broke down and re-entered the 3GL world to write a COBOL
    program which would read a variable-length Fortran carriage control
    report file and write a normal text file with <FF> characters stripping
    the first byte of the record off in the output file (saving a little
    space...). Additionally, a "$Page" token was inserted after the
    <FF> character to allow for its re-insertion via global search and
    replace should it be dropped by passing the file to a finicky tool.
   
    The program which I have attached as a reply to this note has worked 
    quite well for us so far. We thought we'd save others re-inventing
    the wheel by making it available via the Notes file.
    
    To compile it, simply $cob Conv_fcc_to_ff and $link Conv_fcc_to_ff.
    No linkage to system or run-time libraries is required.
    
    To run it, be sure to assign FOCUS$TMP to the file generated by
    Focus and FOCUS$RPT to the report file containing <FF>'s you want 
    to create.
    
    If you have any questions regarding this utility, please feel free
    to call me at dtn 244-6136.

T.RTitleUserPersonal
Name
DateLines
109.1CONV_FCC_TO_FF.COBAKOV88::BIBEAULT_BBob Bibeault, Corp Acct Plan &amp; SystemsMon Aug 08 1988 16:10139
IDENTIFICATION DIVISION.
PROGRAM-ID. CONV_FCC_TO_FF.
AUTHOR. BOB BIBEAULT.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
	SYMBOLIC CHARACTERS FF IS 013.

INPUT-OUTPUT SECTION.
FILE-CONTROL.
	SELECT OPTIONAL FOCUS_TMP  ASSIGN TO 'FOCUS$TMP'
		ORGANIZATION SEQUENTIAL
		ACCESS IS SEQUENTIAL
		FILE STATUS IS FOCUS_TMP_STATUS.
	SELECT          FOCUS_RPT  ASSIGN TO 'FOCUS$RPT'
		ORGANIZATION SEQUENTIAL
		ACCESS IS SEQUENTIAL
		FILE STATUS IS FOCUS_RPT_STATUS.

DATA DIVISION.
FILE SECTION.

	FD 	FOCUS_TMP
		RECORD VARYING FROM 1 TO 133 CHARACTERS
		DEPENDING ON FOCUS_TMP_LENGTH.
	01	FOCUS_TMP_RECORD	PIC X(133).
	
	FD	FOCUS_RPT
		RECORD VARYING FROM 1 TO 132 CHARACTERS
		DEPENDING ON FOCUS_RPT_LENGTH.
	01	FOCUS_RPT_RECORD	PIC X(132).


WORKING-STORAGE SECTION.

01  FILE_STATUS_ETC.
    03 FOCUS_TMP_STATUS			PIC X(2).
    03 FOCUS_RPT_STATUS			PIC X(2).
    03 FOCUS_TMP_LENGTH			PIC 9(3) COMP.
    03 FOCUS_RPT_LENGTH			PIC 9(3) COMP.

01  FILE_RECORD_AREA.
    03 FOCUS_TMP_AREA.
	05 FCC_BYTE			PIC X(1).
	05 TEXT_AREA			PIC X(132).
    03 FOCUS_RPT_AREA.
	05 TEXT_AREA			PIC X(132).

01  LOGICAL_SWITCHES.
    03 DONE_SW				PIC X.
	88 DONE		VALUE 'Y'.

01  MISC.
    03 PAGE_MARKER.
	05 FORMFEED			PIC X    VALUE FF.
	05 FILLER			PIC X(5) VALUE "$Page".

01  ACCUMULATORS COMP.
	05 N_READ			PIC S9(9).
	05 N_WRITTEN			PIC S9(9).
	05 N_FF				PIC S9(9).
	05 N_BLOCKS			PIC S9(9).
	05 N_BYTES			PIC S9(9).

01  DISPLAY_RESULTS.
    03 SUMMARY_IO_LINE.
	05 FILLER			PIC X(5)	VALUE 'Read:'.
	05 SHOW_READ			PIC ZZZZZZ,ZZ9B.
	05 FILLER			PIC X(8)	VALUE 'Written:'.
	05 SHOW_WRITTEN			PIC ZZZZZZ,ZZ9B.
	05 FILLER			PIC X(6)	VALUE 'Pages:'.
	05 SHOW_PAGES			PIC ZZZZZZ,ZZ9B.
	05 FILLER			PIC X(7)	VALUE 'Blocks:'.
	05 SHOW_BLOCKS			PIC ZZZZZZ,ZZ9B.

01 SCR_PGM_VER_SHOTIME.
    03 SCR_VERSION.
	05 SCR_MODULE_ID		PIC X(16) 	VALUE 'CONV_FCC_TO_FF'.
	05 FILLER			PIC X.
    	05 SCR_VERSION_ID		PIC X(24) VALUE 'Version 88.08.04.22'.

PROCEDURE DIVISION.
AA0000-MAIN SECTION.
AA1000-BEGIN.
	DISPLAY ' '
	DISPLAY SCR_VERSION.
	DISPLAY ' '.
AA1100-OPEN-IN.
	OPEN INPUT FOCUS_TMP.
	READ FOCUS_TMP INTO FOCUS_TMP_AREA 
		AT END 	DISPLAY 'File FOCUS$TMP Empty or Not Found'
			MOVE 'Y' TO DONE_SW
			GO TO AA9999-EXIT.
AA1200-OPEN-OUT.
	OPEN OUTPUT FOCUS_RPT.

AA2000-REFORMAT.
	PERFORM BB0000-PROCESS THRU BB9999-EXIT UNTIL DONE.

AA8000-CLOSE.
	CLOSE FOCUS_RPT.
	CLOSE FOCUS_TMP.

AA9000-SUMMARY.
	MOVE N_READ			TO SHOW_READ.
	MOVE N_WRITTEN			TO SHOW_WRITTEN.
	DIVIDE N_BYTES BY 512		GIVING SHOW_BLOCKS ROUNDED.
	IF N_FF > 0 THEN
		ADD 1, N_FF		GIVING SHOW_PAGES
	END-IF.
	DISPLAY ' '
	DISPLAY SUMMARY_IO_LINE.
	DISPLAY ' '.
AA9999-EXIT. STOP RUN.


BB0000-PROCESS SECTION.
BB1000-MOVE.
	IF FCC_BYTE = '1' THEN
		MOVE PAGE_MARKER TO FOCUS_RPT_AREA
		MOVE 6 TO FOCUS_RPT_LENGTH
		ADD 1 TO N_FF
	ELSE
		MOVE TEXT_AREA OF FOCUS_TMP_AREA TO TEXT_AREA OF FOCUS_RPT_AREA
		SUBTRACT 1 FROM FOCUS_TMP_LENGTH GIVING FOCUS_RPT_LENGTH
	END-IF.
	IF FOCUS_RPT_LENGTH < 1 THEN
		MOVE 1 TO FOCUS_RPT_LENGTH
	END-IF.
	ADD FOCUS_RPT_LENGTH TO N_BYTES.
BB8000-WRITE.
	WRITE FOCUS_RPT_RECORD FROM FOCUS_RPT_AREA.
	MOVE  SPACES TO FOCUS_RPT_AREA.
	ADD 1 TO N_WRITTEN.
BB9000-READ.
	READ FOCUS_TMP INTO FOCUS_TMP_AREA AT END MOVE 'Y' TO DONE_SW.
	ADD 1 TO N_READ.
BB9999-EXIT. EXIT.
    
109.2Thanks!MEMV02::COPPERSMITHIt&#039;s an allegory...Tue Aug 09 1988 14:124
    Solves a problem we've been chasing so we stole the code.  Thanks,
    and if you ever need a user written subroutine...
    
    Curtis Coppersmith
109.3Back-end Report Driver Runs CONV_FCC_TO_FFAKOV12::BIBEAULTUnlimited PossibilitiesThu Aug 11 1988 10:385
    
    A report driver for reports created by Focus which runs CONV_FCC_TO_FF
    then allows users to edit, view one page at a time, mail or print
    the report is included in note 111.0.