How to Read Csv Text File Into Numeric Record Cobol
Comma Delimited File Read and Parse |
Introduction
This suite of sample programs describes how to read a comma-delimited file (filename.CSV, Comma-Separated-Value) of variable length strings and create a column oriented file of stock-still length records and fixed length fields. If a cord (or data field) contains a delimiter character then process as data. The program may be adjusted to access a delimited file using a tab, semicolon or other character as the delimiter.
Nosotros have made a meaning effort to ensure the documents and software technologies are correct and accurate. We reserve the right to brand changes without detect at whatever time. The office delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.
Copyright © 1987-2022
SimoTime Technologies and Services
All Rights Reserved
Programming Objectives
This case illustrates the following functions.
| ||||||||
Programming Objectives, Read and Parse a CSV File for Conversion to Stock-still Field Format |
Programming Input and Output
The following is an example of a Comma Delimited file that was that was used to create a Sequential (or LINE Sequential) file that contained records with predefined, fixed fields. This file was created using Microsoft Excel.
100,,Anderson,Adrian,"1113 Peachtree Plaza, Suite 111",,Atlanta,GA,26101 200,,Chocolate-brown,Billie,224 Baker Boulevard,,Baltimore,MD,35702 300,,Carson,Cameron,336 Crenshaw Blvd.,,Cupertino,CA,96154 400,,Davidson,Dion,448 Main Street,,Wilmington,DE,27323 500,,Everest,Evan,55 5TH Artery,,New York,NY,10341 600,,Franklin,Francis,6612 66TH Avenue,,Boulder,NY,11903 700,,Garfunkel,Gwen,777 77TH Street,,New York,NY,16539 800,,Harrison,Hilary,888 88TH Street,,Pocatello,ID,79684 900,,Isley,Isabel,999 99TH Avenue,,Indianapolis,IN,38762 1000,,Johnson,Jamie,1010 Paradise Bulldoze,,Larkspur,CA,90504 1100,,Kemper,Kelly,1111 Oak Circle,,Kansas City,KS,55651 1200,,Lemond,Lesley,1212 Lockwood Road,,Mohave Desert,AZ,80303 1300,,Mitchell,Marlow,1313 Miller Creek Road,,Anywhere,TX,77123 1400,,Newman,Noel,1414 Park Avenue,,Santa Monica,CA,90210 1500,,Osborn,Owen,1515 Centre Phase,,Rolling Rock,PA,36613 1600,,Powell,Pierce,PO Box 1616,,Ventura,CA,97712 1700,,Quigley,Quincy,1717 Farm Hill Route,,Oshkosh,WI,43389 1800,,Ripley,Ray,1818 Alien Lane,,Wayout,KS,55405 1900,,Smith,Sammy,1919 Carnoustie Drive,,Novato,CA,94919 2000,,Tucker,Taylor,2020 Sanger Lane,,St. Paul,MN,43998 2100,,Underwood,Ulysses,2121 Wall Street,,New York,NY,17623 2200,,Van Etten,Valerie," 2222 Vine Street, #22",,Hollywood,CA,98775 2300,,Wilson,Wiley,"2323 Principal Street, #23",, Boston,MA,1472 2400,,Xray,Xavier,2424 24TH Street,,Nashville,TN,44190 2500,,Young,Yanni,2525 Yonge Street,,Toronto,ON,6B74A6 2600,,Zenith,Zebulon,2626 26TH Street,,Dallas,TX,71922 123456,,Doe,John,123 Main Street,,Anywhere,OR,88156 999999,,Smith,, 99 E Street,, San Rafael,CA,94901
The post-obit is an example of a sequential (or Line Sequential) file that contains records with predefined, fixed-length fields. This file was created by a COBOL program that read and parsed strings in a Comma Delimited file (filename.CSV).The client number is in positions 1 through 12. Notice that customer numbers 000000002200, 000000002300 and 000000999999 contain examples of fields with leading spaces and fields that incorporate a comma in the information cord. All the records have abaft spaces in the fields.
000000000100 Anderson Adrian 1113 Peachtree Plaza, Suite 111 Atlanta GA26101 000000000200 Brown Billie 224 Baker Boulevard Baltimore MD35702 000000000300 Carson Cameron 336 Crenshaw Blvd. Cupertino CA96154 000000000400 Davidson Dion 448 Master Street Wilmington DE27323 000000000500 Everest Evan 55 fifth Avenue New York NY10341 000000000600 Franklin Francis 6612 66TH Avenue Bedrock NY11903 000000000700 Garfunkel Gwen 777 77TH Street New York NY16539 000000000800 Harrison Hilary 888 88TH Street Pocatello ID79684 000000000900 Isley Isabel 999 99TH Avenue Indianapolis IN38762 000000001000 Johnson Jamie 1010 Paradise Drive Larkspur CA90504 000000001100 Kemper Kelly 1111 Oak Circle Kansas City KS55651 000000001200 Lemond Lesley 1212 Lockwood Road Mohave Desert AZ80303 000000001300 Mitchell Marlow 1313 Miller Creek Road Anywhere TX77123 000000001400 Newman Noel 1414 Park Avenue Santa Monica CA90210 000000001500 Osborn Owen 1515 Center Stage Rolling Stone PA36613 000000001600 Powell Pierce PO Box 1616 Ventura CA97712 000000001700 Quigley Quincy 1717 Farm Colina Road Oshkosh WI43389 000000001800 Ripley Ray 1818 Alien Lane Wayout KS55405 000000001900 Smith Sammy 1919 Carnoustie Drive Novato CA94919 000000002000 Tucker Taylor 2020 Sanger Lane St. Paul MN43998 000000002100 Underwood Ulysses 2121 Wall Street New York NY17623 000000002200 Van Etten Valerie 2222 Vine Street, #22 Hollywood CA98775 000000002300 Wilson Wiley 2323 Primary Street, #23 Boston MA1472 000000002400 Xray Xavier 2424 24TH Street Nashville TN44190 000000002500 Young Yanni 2525 Yonge Street Toronto ON6B74A6 000000002600 Zenith Zebulon 2626 26TH Street Dallas TX71922 000000123456 Doe John 123 Main Street Anywhere OR88156 000000999999 Smith 99 E Street San Rafael CA94901
Programming Requirements
This suite of samples programs volition run on the following platforms.
| ||||
Programming Requirements, Operating Environments for Program Execution |
Programming Overview
The main program (CBLCSVC2) will read an ASCII/Text file with CSV formatted records (CSVGETD1) and produce a file with the tape content being a fixed field format (TXTPUTD1), The record length is 512 bytes.. The source code for the CMD file and the COBOL programs is provided and may exist modified to fit your surroundings.
The following is a flowchart of the job for executing the plan to create a Sequential file of fixed-length fields from a Comma Delimited file.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Note-ane: LSEQ = Line Sequential File, Tape Format may be Comma-Separated-Value or Fixed-Field-Length | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Create a Sequential file of fixed-length fields from a Comma Delimited file |
Color Associations: The
CMD for Batch Job
The post-obit (CBLCSVE2.cmd) is a sample of the Windows CMD needed to run this job. This prepare of programs illustrates the use of Micro Focus COBOL programs that will read an ASCII/Text file with a comma-separated-values (CSV) format and create an ASCII/Text file with a cavalcade-oriented, fixed-field-length (FFL) format.
@echo OFF echo * CblCsvE2 is Starting... rem * ******************************************************************* rem * CBLCSVE2.CMD - a Windows Control File * rem * This programme is provided past SimoTime Technologies * rem * (C) Copyright 1987-2019 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * ******************************************************************* rem * rem * Text - COBOL, read a LCSV file and create a LFFL file. rem * Author - SimoTime Technologies rem * Engagement - December 12, 2003 rem * Version - 04.01.xx rem * rem * This fix of programs illustrates the apply COBOL programs that volition rem * read an ASCII/Text file with a Comma-Separated-Values (CSV) format rem * and create an ASCII/Text file with a column-oriented, rem * Fixed-Field-Length (FFL) format. rem * rem * The COBOL program is compiled with the ASSIGN(EXTERNAL) directive. rem * This provides for external file mapping of the file names. rem * rem * This set of programs will run on a Personal Computer with Windows rem * and Micro Focus Internet Express. rem * rem * ************ rem * * CblCsvE2 * rem * ********cmd* rem * * rem * * rem * ************ ************ rem * * if EXIST ******* CUSTLFFL * rem * *******stmt* ******erase* rem * * rem * ************ ************ ************ rem * * CUSTLCSV ******* CblCsvC2 ******* CUSTLFFL * rem * *******lcsv* ********cbl* *******lffl* rem * * rem * ************ rem * * EOJ * rem * ************ rem * rem * Note-1: LCSV=Line Sequential with Comma-Separated-Values format. rem * Notation-2: LFFL=Line Sequential with Fixed-Field-Length format. rem * rem * ******************************************************************** rem * Step 1 of ii Set the global environment variables... rem * call ..\Env1BASE if "%SYSLOG%" == "" prepare syslog=c:\SimoLIBR\LOGS\SimoTime.LOG ready JobName=CblCsvE2 rem * telephone call SimoNOTE "*******************************************************%JobName%" call SimoNOTE "Starting JobName %JobName%, User is %USERNAME%" rem * rem * ******************************************************************* rem * Footstep 2 of 2 Execute the program, create a TXT file. rem * set CUSTLCSV=%BaseLib1%\Data\XLSS\SIMOTIME.TEXT.CUSTLCSV.CSV set CUSTLFFL=%BaseLib1%\DATA\TXT1\SIMOTIME.TEXT.CUSTLFFL.TXT ready SYSOUT=%BaseLib1%\LOGS\SIMOTIME.SYSOUT.CBLCSVE2.TXT if exist %CUSTLFFL% erase %CUSTLFFL% run CBLCSVC2 if not "%ERRORLEVEL%" == "0" set JobStatus=0010 if not %JobStatus% == 0000 goto :EojNok rem * if exist %CUSTLFFL% goto :EojAok set JobStatus=0020 goto :EojNok :EojAok phone call SimoNOTE "DataTake CUSTLCSV=%CUSTLCSV%" call SimoNOTE "DataMake CUSTLFFL=%CUSTLFFL%" call SimoNOTE "Finished JobName %JobName%, Job Status is %JobStatus%" goto :Cease :EojNok telephone call SimoNOTE "ABENDING JobName %JobName%, Job Status is %JobStatus%" :Cease call SimoNOTE "Conclude SysLog is %SYSLOG%" if not "%1" == "nopause" pause
The COBOL Programs
The conversion process uses 2 (2) programs. The mainline plan does the file I/O and calls the conversion routine to the tape content conversion. The following describes the two programs.
The COBOL I/O Programme
The following (CBLCSVC2.cbl) is a sample of the Micro Focus COBOL demonstration program. This plan will not compile or execute on an IBM Mainframe because of the ORGANIZATION IS LINE SEQUENTIAL on the SELECT statement. If the statement was changed to read ORGANIZATION IS SEQUENTIAL it would run on an IBM Mainframe and "read from" and "write to" a sequential file. The programme was tested using Micro Focus Cyberspace Express, version six.0 running on Windows/seven.
IDENTIFICATION DIVISION. Plan-ID. CBLCSVC2. Author. SIMOTIME TECHNOLOGIES. ***************************************************************** * This plan was generated past SimoZAPS * * A production of SimoTime Technologies * * Our e-mail accost is: helpdesk@simotime.com * * Besides, visit our Spider web Site at http://world wide web.simotime.com * * * * Generation Date: 2012-01-16 Generation Time: 13:01:02:99 * * * * Record Record Key * * Office Proper noun Arrangement Format Max-Min Pos-Len * * INPUT CUSTLCSV ASCII/CRLF VARIABLE 00512 * * * * OUTPUT CUSTLFFL ASCII/CRLF Fixed 00512 * * * * * ***************************************************************** ENVIRONMENT Segmentation. INPUT-OUTPUT SECTION. FILE-Command. SELECT CUSTLCSV-FILE ASSIGN TO CUSTLCSV ORGANIZATION IS LINE SEQUENTIAL ACCESS Way IS SEQUENTIAL FILE STATUS IS CUSTLCSV-STATUS. SELECT CUSTLFFL-FILE ASSIGN TO CUSTLFFL Organisation IS LINE SEQUENTIAL Admission MODE IS SEQUENTIAL FILE Condition IS CUSTLFFL-Condition. ***************************************************************** Data Sectionalization. FILE Department. FD CUSTLCSV-FILE DATA Tape IS CUSTLCSV-REC . 01 CUSTLCSV-REC. 05 CUSTLCSV-DATA-01 PIC X(00512). FD CUSTLFFL-FILE DATA RECORD IS CUSTLFFL-REC . 01 CUSTLFFL-REC. 05 CUSTLFFL-DATA-01 PIC X(00512). ***************************************************************** * This program was created with the SYSMASK3.TXT file as the * * template for the File I/O. It is intended for use with the * * TransCALL facility that makes a call to a routine that does * * the actual conversion betwixt EBCDIC and ASCII. For more * * information or questions contact SimoTime Technologies. * * * * Our email address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * * The SYSMASK3 provides for the sequential reading of the input * * file and the sequential writing of the output file. * * * * This plan mask is used with a callable subroutine that * * will practice ASCII/EBCDIC Conversion based on a COBOL Re-create File. * * * * If the output file is indexed then the input file must exist in * * sequence by the field that will exist used to provide the fundamental * * for the output file. * * * * If the central field is non in sequence then refer to SYSMASK4 * * to provide for a random add together or update of the indexed file. * ***************************************************************** WORKING-STORAGE SECTION. 01 SIM-TITLE. 05 T1 pic X(eleven) value '* CBLCSVC2 '. 05 T2 pic X(34) value 'Convert a CUSTLCSV to a CUSTLFFL '. 05 T3 pic X(ten) value ' v10.07.06'. 05 T4 film X(24) value ' helpdesk@simotime.com'. 01 SIM-COPYRIGHT. 05 C1 motion picture X(11) value '* CBLCSVC2 '. 05 C2 movie X(32) value 'This Information File Convert Member wa'. 05 C3 pic X(32) value 's generated by SimoTime Technolo'. 05 C4 pic X(04) value 'gies'. 01 CUSTLCSV-STATUS. 05 CUSTLCSV-Status-50 pic X. 05 CUSTLCSV-STATUS-R pic X. 01 CUSTLCSV-EOF pic Ten value 'N'. 01 CUSTLCSV-Open up-FLAG pic 10 value 'C'. 01 CUSTLFFL-STATUS. 05 CUSTLFFL-STATUS-L movie 10. 05 CUSTLFFL-STATUS-R pic X. 01 CUSTLFFL-EOF pic X value 'N'. 01 CUSTLFFL-OPEN-FLAG pic Ten value 'C'. 01 CUSTLCSV-LRECL pic ix(v) value 00512. 01 CUSTLFFL-LRECL pic nine(5) value 00512. ***************************************************************** * The following buffers are used to create a four-byte status * * code that may be displayed. * ***************************************************************** 01 IO-STATUS. 05 IO-STAT1 moving picture X. 05 IO-STAT2 pic X. 01 IO-Condition-04. 05 IO-STATUS-0401 film ix value 0. 05 IO-STATUS-0403 pic 999 value 0. 01 TWO-BYTES-BINARY picture show 9(4) BINARY. 01 TWO-BYTES-Blastoff redefines TWO-BYTES-BINARY. 05 TWO-BYTES-LEFT flick X. 05 2-BYTES-Right pic X. ***************************************************************** * Bulletin Buffer used by the Z-Brandish-Message-TEXT routine. * ***************************************************************** 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(eleven) value '* CBLCSVC2 '. 05 MESSAGE-TEXT. 10 Message-TEXT-1 pic X(68) value SPACES. 10 MESSAGE-TEXT-2 pic X(188) value SPACES. ***************************************************************** 01 Plan-NAME pic X(eight) value 'CBLCSVC2'. 01 INFO-STATEMENT. 05 INFO-Short. ten INFO-ID pic X(8) value 'Starting'. 10 filler pic X(2) value ', '. 10 filler film X(34) value 'Convert a CUSTLCSV to a CUSTLFFL '. 05 filler motion-picture show X(24) value ' http://www.SimoTime.com'. 01 APPL-Consequence motion picture S9(9) comp. 88 APPL-AOK value 0. 88 APPL-EOF value sixteen. 01 CUSTLCSV-Full. 05 CUSTLCSV-RDR pic 9(9) value 0. 05 filler pic X(3) value ' - '. 05 filler film Ten(23) value 'Line count for CUSTLCSV'. 01 CUSTLFFL-TOTAL. 05 CUSTLFFL-Add together flick 9(9) value 0. 05 filler film X(3) value ' - '. 05 filler film X(23) value 'Line count for CUSTLFFL'. ***************************************************************** Process Segmentation. movement all '*' to Bulletin-TEXT-one perform Z-DISPLAY-MESSAGE-TEXT move INFO-Statement to Bulletin-TEXT-i perform Z-Brandish-MESSAGE-TEXT move all '*' to MESSAGE-TEXT-ane perform Z-Display-Message-TEXT perform Z-POST-COPYRIGHT perform CUSTLCSV-OPEN perform CUSTLFFL-OPEN perform until CUSTLCSV-Condition not = '00' perform CUSTLCSV-READ if CUSTLCSV-STATUS = '00' add together one to CUSTLCSV-RDR perform BUILD-OUTPUT-RECORD perform CUSTLFFL-WRITE if CUSTLFFL-Status = '00' add 1 to CUSTLFFL-Add end-if cease-if end-perform move CUSTLCSV-TOTAL to MESSAGE-TEXT perform Z-DISPLAY-Message-TEXT move CUSTLFFL-Full to MESSAGE-TEXT perform Z-Brandish-Bulletin-TEXT if APPL-EOF motility 'Complete' to INFO-ID else move 'ABENDING' to INFO-ID end-if move INFO-Statement to MESSAGE-TEXT(i:79) perform Z-DISPLAY-MESSAGE-TEXT perform CUSTLFFL-CLOSE perform CUSTLCSV-Shut GOBACK. ***************************************************************** BUILD-OUTPUT-Tape. * Import CALL process... telephone call 'CBLCSVR2' using CUSTLFFL-REC CUSTLCSV-REC add together 00512 to Nix giving CUSTLFFL-LRECL exit. ***************************************************************** * I/O Routines for the INPUT File... * ***************************************************************** CUSTLCSV-Shut. add together 8 to Zip giving APPL-Issue. close CUSTLCSV-FILE if CUSTLCSV-Condition = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK Go on else movement 'CLOSE Failure with CUSTLCSV' to Bulletin-TEXT perform Z-Display-MESSAGE-TEXT move CUSTLCSV-Status to IO-STATUS perform Z-DISPLAY-IO-Condition perform Z-ABEND-Plan finish-if exit. *---------------------------------------------------------------* CUSTLCSV-READ. read CUSTLCSV-FILE if CUSTLCSV-STATUS = '00' subtract APPL-Effect from APPL-Effect else if CUSTLCSV-Status = '10' add sixteen to Aught giving APPL-Upshot else add together 12 to ZERO giving APPL-RESULT end-if terminate-if if APPL-AOK Continue else if APPL-EOF motion 'Y' to CUSTLCSV-EOF else move 'READ Failure with CUSTLCSV' to MESSAGE-TEXT perform Z-DISPLAY-Message-TEXT motion CUSTLCSV-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if exit. *---------------------------------------------------------------* CUSTLCSV-OPEN. add together viii to ZERO giving APPL-RESULT. open input CUSTLCSV-FILE if CUSTLCSV-STATUS = '00' subtract APPL-RESULT from APPL-Issue motion 'O' to CUSTLCSV-Open-FLAG else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else movement 'OPEN Failure with CUSTLCSV' to Message-TEXT perform Z-DISPLAY-MESSAGE-TEXT motility CUSTLCSV-Condition to IO-STATUS perform Z-DISPLAY-IO-STATUS perform Z-ABEND-Programme end-if exit. ***************************************************************** * I/O Routines for the OUTPUT File... * ***************************************************************** CUSTLFFL-WRITE. if CUSTLFFL-Open-FLAG = 'C' perform CUSTLFFL-Open up finish-if write CUSTLFFL-REC if CUSTLFFL-STATUS = '00' subtract APPL-Effect from APPL-RESULT else if CUSTLFFL-Condition = '10' add together 16 to Nix giving APPL-RESULT else add 12 to ZERO giving APPL-Result stop-if terminate-if. if APPL-AOK Go along else movement 'WRITE Failure with CUSTLFFL' to MESSAGE-TEXT perform Z-DISPLAY-Bulletin-TEXT motion CUSTLFFL-Status to IO-STATUS perform Z-Brandish-IO-Status perform Z-ABEND-PROGRAM terminate-if exit. *---------------------------------------------------------------* CUSTLFFL-Open up. add 8 to ZERO giving APPL-RESULT. open OUTPUT CUSTLFFL-FILE if CUSTLFFL-Status = '00' decrease APPL-Issue from APPL-Result move 'O' to CUSTLFFL-OPEN-FLAG else add together 12 to Nix giving APPL-Consequence end-if if APPL-AOK CONTINUE else movement 'OPEN Failure with CUSTLFFL' to Bulletin-TEXT perform Z-DISPLAY-MESSAGE-TEXT move CUSTLFFL-STATUS to IO-Condition perform Z-Display-IO-Status perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* CUSTLFFL-CLOSE. add 8 to ZERO giving APPL-RESULT. close CUSTLFFL-FILE if CUSTLFFL-STATUS = '00' subtract APPL-Consequence from APPL-RESULT move 'C' to CUSTLFFL-Open up-FLAG else add 12 to Cipher giving APPL-RESULT end-if if APPL-AOK Continue else move 'Shut Failure with CUSTLFFL' to MESSAGE-TEXT perform Z-Display-MESSAGE-TEXT motion CUSTLFFL-STATUS to IO-STATUS perform Z-Display-IO-Status perform Z-ABEND-PROGRAM end-if go out. ***************************************************************** * The post-obit Z-ROUTINES provide administrative functions * * for this programme. * ***************************************************************** * ABEND the program, mail a message to the console and issue * * a STOP RUN. * ***************************************************************** Z-ABEND-Plan. if MESSAGE-TEXT non = SPACES perform Z-Brandish-Bulletin-TEXT end-if move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT perform Z-DISPLAY-Message-TEXT add 12 to ZERO giving Render-Code End RUN. * exit. ***************************************************************** * Brandish Console messages... * ***************************************************************** Z-DISPLAY-MESSAGE-TEXT. if MESSAGE-TEXT-2 = SPACES display MESSAGE-BUFFER(1:79) else display MESSAGE-BUFFER finish-if move all SPACES to MESSAGE-TEXT exit. ***************************************************************** * Display the file status bytes. This routine volition display every bit * * four digits. If the total two byte file status is numeric it * * will display as 00nn. If the 1st byte is a numeric 9 (9) * * the 2d byte will be treated equally a binary number and will * * display as 9nnn. * ***************************************************************** Z-Brandish-IO-STATUS. if IO-Condition non NUMERIC or IO-STAT1 = 'ix' motility IO-STAT1 to IO-STATUS-04(1:1) decrease 2-BYTES-BINARY from 2-BYTES-BINARY move IO-STAT2 to TWO-BYTES-Right add Two-BYTES-BINARY to Cipher giving IO-STATUS-0403 motility 'File Status is: nnnn' to Message-TEXT move IO-STATUS-04 to MESSAGE-TEXT(17:four) perform Z-Display-Message-TEXT else motility '0000' to IO-Condition-04 motion IO-Condition to IO-STATUS-04(3:ii) move 'File Condition is: nnnn' to MESSAGE-TEXT move IO-STATUS-04 to MESSAGE-TEXT(17:4) perform Z-Display-MESSAGE-TEXT end-if exit. ***************************************************************** Z-Mail-COPYRIGHT. display SIM-TITLE display SIM-COPYRIGHT exit. ***************************************************************** * This program was generated by SimoZAPS * * A product of SimoTime Technologies * * Our e-mail service accost is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * * Generation Engagement: 2012-01-16 Generation Time: 13:01:03:02 * *****************************************************************
The COBOL Convert Routine
The post-obit (CBLCSVR2.cbl) is a sample of the Micro Focus COBOL conversion routine from Comma-Separated-Values (CSV) to Fixed-Field-Length (FFL) formats. The program was tested using Micro Focus Net Express, version 6.0 running on Windows/vii.
IDENTIFICATION DIVISION. Plan-ID. CBLCSVR2. Writer. SIMOTIME TECHNOLOGIES. ***************************************************************** * This routine was generated by SimoREC1 * * A product of SimoTime Technologies * * Our eastward-mail address is: helpdesk@simotime.com * * Also, visit our Spider web Site at http://www.simotime.com * * Generation Date: 2012/01/sixteen Generation Fourth dimension: thirteen:01:03:19 * ***************************************************************** DATA DIVISION. WORKING-STORAGE SECTION. 01 NGZU-12-00. 05 NRZU-12-00 picture 9(12). 01 Ix-P1 moving picture ix(9) value 0. 01 Ix-P2 flick 9(9) value 0. 01 IX-NP movie nine(five) value 0. 01 Ix-L1 picture show 9(9) value 0. 01 RA-P1 picture ix(3) value 0. 01 RA-P2 moving-picture show 9(3) value 0. 01 LOOP-Control movie nine(5) value 0. 01 Cavalcade-NUMBER flick 9(5) value 0. 01 Work-Surface area-Ten. 05 Piece of work-Area-X1 pic X value '"'. 05 Work-Surface area picture show 10(00544) value SPACES. 01 Work-AREA-X2 pic Ten(00512) value SPACES. 01 FRAME-STOP. 05 FRAME-BYTE pic X value '"'. 05 DELIMITER-BYTE flick X value ','. 01 FRAME-FLAG pic X value 'N'. 01 O-FLAG pic 10(3) value 'CSV'. 01 BYTE-Y pic X value 'Y'. 01 BYTE-N motion-picture show 10 value 'Northward'. 01 FRAME-COUNT pic ix(five) value 0. 01 DELIM-COUNT motion picture 9(5) value 0. 01 FFL-SIZE pic 9(5) value 0. 01 CSV-SIZE picture ix(5) value 0. 01 LAST-NON-SPACE-BYTE motion-picture show ix(5) value 0. 01 SIGN-BYTE pic X value SPACE. 01 DIG-POS moving picture 9(3). 01 DIG-LEN movie 9(three). 01 DIG-CTL pic 9(three). 01 DEC-POS pic 9(three). 01 DEC-LEN flick nine(3). 01 December-CTL picture show nine(3). 01 Dec-POINT pic 9(three). * ***************************************************************** LINKAGE Section. COPY CUSTTXB1. 01 REC1CALL-REC pic X(00512). * ***************************************************************** Procedure DIVISION using CUSTTEXT-Tape REC1CALL-REC. * add one to Naught giving Nine-NP move ZERO to COLUMN-NUMBER move all SPACES to CUSTTEXT-RECORD * * Number Move, CUSTTEXT-Central * Unsign, ZONED Decimal add 1 to COLUMN-NUMBER add 00012 to Cipher giving FFL-SIZE perform CONVERT-NUMBER perform POST-Information-TO-FIELD * * String Move, CUSTTEXT-Status add 1 to Cavalcade-NUMBER add 00001 to Zippo giving FFL-SIZE perform CONVERT-TEXT perform Mail service-Data-TO-FIELD * * String Movement, CUSTTEXT-LAST-NAME add 1 to Cavalcade-NUMBER add together 00028 to ZERO giving FFL-SIZE perform Convert-TEXT perform POST-DATA-TO-FIELD * * String Move, CUSTTEXT-Commencement-NAME add 1 to COLUMN-NUMBER add together 00020 to Zero giving FFL-SIZE perform Convert-TEXT perform POST-DATA-TO-FIELD * * String Movement, CUSTTEXT-STREET-ADDR-01 add i to Column-NUMBER add together 00048 to Aught giving FFL-SIZE perform Convert-TEXT perform Mail-Data-TO-FIELD * * Cord Movement, CUSTTEXT-STREET-ADDR-02 add together 1 to Cavalcade-NUMBER add 00048 to ZERO giving FFL-SIZE perform CONVERT-TEXT perform POST-DATA-TO-FIELD * * String Move, CUSTTEXT-CITY add ane to COLUMN-NUMBER add together 00016 to ZERO giving FFL-SIZE perform Convert-TEXT perform Postal service-Data-TO-FIELD * * Cord Motion, CUSTTEXT-State add 1 to COLUMN-NUMBER add 00002 to Cypher giving FFL-SIZE perform CONVERT-TEXT perform POST-Data-TO-FIELD * * String Move, CUSTTEXT-POSTAL-Code add 1 to Column-NUMBER add 00012 to Nil giving FFL-SIZE perform Convert-TEXT perform Postal service-Information-TO-FIELD GOBACK. * ***************************************************************** Catechumen-NUMBER. move SPACES to Piece of work-AREA move '+' to SIGN-BYTE perform GET-DATA-CONTENT * Scan for Explicit Sign and Decimal Point... motility ZERO to DIG-POS move Nada to DIG-LEN move Nix to DEC-POS move Null to DEC-LEN movement ZERO to December-Point add together i to ZERO giving IX-L1 if Work-Surface area(i:1) = '+' or Work-Area(1:1) = '-' motility Work-AREA(1:1) to SIGN-BYTE add 1 to IX-L1 end-if perform until IX-L1 > forty or WORK-AREA(IX-L1:ane) = SPACE if Piece of work-AREA(9-L1:1) = '+' or WORK-AREA(IX-L1:one) = '-' move WORK-AREA(Nine-L1:i) to SIGN-BYTE move SPACES to Piece of work-AREA(Nine-L1:3) end-if if Piece of work-AREA(IX-L1:1) = '.' add IX-L1 to ZERO giving DEC-Betoken end-if if WORK-Area(IX-L1:1) > '0' and Work-Surface area(IX-L1:i) < 'nine' or WORK-AREA(IX-L1:i) = '0' or Work-Area(IX-L1:1) = 'nine' if December-POINT = Null add 1 to DIG-LEN if DIG-POS = ZERO add IX-L1 to DIG-POS end-if else add 1 to DEC-LEN if DEC-POS = Nix add together IX-L1 to DEC-POS end-if cease-if end-if add 1 to IX-L1 end-perform go out. * ***************************************************************** Catechumen-TEXT. move SPACES to Work-AREA perform GET-Information-CONTENT exit. * ***************************************************************** Become-Data-CONTENT. * This routine performs a left-to-right scan of a data * string. A data string may be enclosed within a set * of framing characters (ordinarily double-quotes). * Concatenated data strings may be separated past a * delimiter byte (usually a comma). * The variable length data value minus the possible * framing characters and will be placed in a work area * for utilise with a stock-still-length field format. ***************************************************************** add 1 to ZERO giving IX-P2 move ZERO to LOOP-Control motion BYTE-Due north to FRAME-FLAG if REC1CALL-REC(IX-NP:1) = FRAME-BYTE motility BYTE-Y to FRAME-FLAG add ane to 9-NP end-if if REC1CALL-REC(IX-NP:one) not = DELIMITER-BYTE or FRAME-FLAG = BYTE-Y perform until REC1CALL-REC(Ix-NP:ane) = DELIMITER-BYTE and FRAME-FLAG = BYTE-N or LOOP-Command > FFL-SIZE + x if REC1CALL-REC(IX-NP:one) = FRAME-BYTE if REC1CALL-REC(9-NP:ii) = FRAME-STOP add 1 to Nine-NP movement BYTE-Northward to FRAME-FLAG else add together 1 to 9-NP motility REC1CALL-REC(Ix-NP:1) to WORK-Surface area(9-P2:1) add 1 to IX-NP add together one to IX-P2 end-if else move REC1CALL-REC(Ix-NP:i) to Work-AREA(9-P2:ane) add 1 to Ix-NP add together 1 to 9-P2 end-if add together one to LOOP-CONTROL end-perform end-if * Increment past Delimiter Byte if REC1CALL-REC(Ix-NP:1) = DELIMITER-BYTE add together 1 to Nine-NP end-if exit. * ***************************************************************** Post-DATA-TO-FIELD. evaluate Column-NUMBER when 001 initialize NGZU-12-00 add 12 to ZERO giving DIG-CTL add together 00 to ZERO giving Dec-CTL if DIG-LEN > 0 if DIG-LEN > DIG-CTL perform until DIG-LEN < DIG-CTL + 1 subtract 1 from DIG-LEN add i to DIG-POS cease-perform end-if motility Work-Expanse(DIG-POS:DIG-LEN) to NGZU-12-00(1 + DIG-CTL - DIG-LEN:DIG-LEN) terminate-if if Dec-LEN > 0 if December-LEN > December-CTL add DEC-CTL to ZERO giving December-LEN end-if move WORK-AREA(Dec-POS:DEC-LEN) to NGZU-12-00(DIG-CTL + 1:December-LEN) end-if if NRZU-12-00 is NUMERIC if SIGN-BYTE = '-' subtract NRZU-12-00 from Cipher giving CUSTTEXT-KEY else add NRZU-12-00 to ZERO giving CUSTTEXT-KEY finish-if else display 'not-Numeric in Numeric Field' end-if when 002 move WORK-AREA(one:FFL-SIZE) to CUSTTEXT-STATUS when 003 move Work-Expanse(1:FFL-SIZE) to CUSTTEXT-Terminal-Name when 004 move Work-AREA(1:FFL-SIZE) to CUSTTEXT-FIRST-Proper noun when 005 move WORK-Area(1:FFL-SIZE) to CUSTTEXT-STREET-ADDR-01 when 006 motion WORK-Area(i:FFL-SIZE) to CUSTTEXT-STREET-ADDR-02 when 007 movement Work-Area(1:FFL-SIZE) to CUSTTEXT-CITY when 008 move Piece of work-AREA(i:FFL-SIZE) to CUSTTEXT-State when 009 movement Piece of work-AREA(1:FFL-SIZE) to CUSTTEXT-POSTAL-Code end-evaluate exit. ***************************************************************** * This routine was generated by SimoREC1 * * A product of SimoTime Technologies * * Our electronic mail address is: helpdesk@simotime.com * * Also, visit our Spider web Site at http://www.simotime.com * * Generation Date: 2012/01/16 Generation Time: 13:01:03:19 * *****************************************************************
The COBOL Parsing Program
The following (SIMOPARS.cbl) is the COBOL parsing programme.
IDENTIFICATION DIVISION. Program-ID. SIMOPARS. Writer. SIMOTIME TECHNOLOGIES. ***************************************************************** * Copyright (C) 1987-2019 SimoTime Technologies. * * * * All rights reserved. Unpublished, all rights reserved under * * copyright law and international treaty. Use of a copyright * * find is precautionary just and does not imply publication * * or disclosure. * * * * Permission to use, copy, alter and distribute this software * * for any not-commercial purpose and without fee is hereby * * granted, provided the SimoTime copyright observe announced on all * * copies of the software. The SimoTime name or Logo may not be * * used in any advertisement or publicity pertaining to the employ * * of the software without the written permission of SimoTime * * Technologies. * * * * Permission to employ, copy, modify and distribute this software * * for whatever commercial purpose requires a fee to be paid to * * SimoTime Technologies. Once the fee is received by SimoTime * * the latest version of the software will be delivered and a * * license volition be granted for use within an enterprise, * * provided the SimoTime copyright notice appear on all copies * * of the software. The SimoTime name or Logo may not be used * * in whatever advertising or publicity pertaining to the use of the * * software without the written permission of SimoTime * * Technologies. * * * * SimoTime Technologies makes no warranty or representations * * most the suitability of the software for any purpose. It is * * provided "AS IS" without whatsoever expressed or implied warranty, * * including the implied warranties of merchantability, fitness * * for a particular purpose and non-infringement. SimoTime * * Technologies shall non be liable for any direct, indirect, * * special or consequential damages resulting from the loss of * * apply, data or projects, whether in an action of contract or * * tort, arising out of or in connection with the use or * * performance of this software * * * * SimoTime Technologies * * 15 Carnoustie Drive * * Novato, CA 94949-5849 * * 415.883.6565 * * * * RESTRICTED RIGHTS LEGEND * * Use, duplication, or disclosure by the Government is subject * * to restrictions as set forth in subparagraph (c)(1)(ii) of * * the Rights in Technical Data and Computer Software clause at * * DFARS 52.227-7013 or subparagraphs (c)(1) and (two) of * * Commercial Computer Software - Restricted Rights at 48 * * CFR 52.227-nineteen, as applicable. Contact SimoTime Technologies, * * 15 Carnoustie Bulldoze, Novato, CA 94949-5849. * * * ***************************************************************** * This program is provided by SimoTime Technologies * * Our due east-mail accost is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * ***************************************************************** * ***************************************************************** * Source Member: SIMOPARS.CBL * Copy Files PASSPARS.CPY ***************************************************************** * * SIMOPARS - Parse Buffer defined in pass area. * * CALLING PROTOCOL * ---------------- * phone call 'SIMOPARS' using PRS-PARAMETERS * * 01 PRS-PARAMETERS. * 05 PRS-Asking PIC X VALUE '0'. * 05 PRS-STATUS PIC ix(4). * 05 PRS-DELIMITER PIC Ten VALUE Space. * 05 PRS-KEEP-Nada-FIELDS Motion picture X VALUE 'N'. * 05 PRS-Suspend PIC X VALUE 'N'. * 05 PRS-SUSPEND-BYTE PIC X VALUE SPACE. * 05 PRS-TERMINATOR PIC Ten VALUE 'N'. * 05 PRS-TERMINATOR-BYTE PIC Ten VALUE Infinite. * 05 PRS-BUFFER-SIZE Picture nine(4) VALUE 2048. * 05 PRS-BUFFER Film X(2048). * 05 PRS-TABLE-MAX Picture 9(4) VALUE 128. * 05 PRS-NUMBER-OF-ITEMS Movie 9(4) VALUE 0. * 05 PRS-LAST-SIG-BYTE PIC 9(4) VALUE 0. * 05 PRS-POSITION OCCURS 128 TIMES * PIC 9(4) VALUE 0. * 05 PRS-SIZE OCCURS 128 TIMES * * This routine uses reference modification to identify the * position of the first significant character after the * delimiter grapheme. This approach compensates for multiple * leading or embedded delimiter characters. The string office * of COBOL does non handle leading spaces. * * For example, if the delimiter character is a space then * leading spaces volition be ignored and multiple, embedded spaces * will be treated as a single space. * * MAINTENANCE * ----------- * 1998/01/02 Simmons, CREATED PROGRAM. * 1998/01/02 Simmons, No changes to date... * ***************************************************************** * ENVIRONMENT Segmentation. DATA DIVISION. WORKING-STORAGE SECTION. ***************************************************************** * Information-structure for Program apply... * ***************************************************************** 01 I-PTR pic ix(4) value 0. 01 O-PTR pic 9(4) value 0. 01 B-COUNT pic ix(iv) value 0. ***************************************************************** * Bulletin Buffer used past the Z-Display-MESSAGE-TEXT routine. * ***************************************************************** 01 Message-BUFFER. 05 Bulletin-HEADER pic Ten(eleven) value '* SIMOPARS '. 05 Bulletin-TEXT. 10 Message-TEXT-1 moving picture X(68) value SPACES. 10 MESSAGE-TEXT-2 motion picture X(188) value SPACES. ***************************************************************** LINKAGE SECTION. Re-create PASSPARS. ***************************************************************** PROCEDURE Sectionalization using PRS-PARAMETERS. if PRS-Asking not = 'ii' perform EDIT-LINKAGE-ITEMS end-if add together 8 to Zilch giving RETURN-CODE add nine to ZERO giving PRS-STATUS motility ZERO to PRS-NUMBER-OF-ITEMS evaluate PRS-REQUEST when '0' perform PARSE-BUFFER when 'i' perform INITIALIZE-Tabular array-ELEMENTS when 'ii' perform INITIALIZE-DEFAULT-VALUES when OTHER add 12 to Null giving PRS-STATUS end-evaluate if PRS-STATUS = ix subtract PRS-Condition from PRS-STATUS end-if GOBACK. ***************************************************************** EDIT-LINKAGE-ITEMS. if PRS-TABLE-MAX not numeric add together 128 to ZERO giving PRS-TABLE-MAX motion 'PRS-Table-MAX set to 128' to MESSAGE-TEXT perform Z-Display-MESSAGE-TEXT end-if if PRS-Table-MAX > 128 add 128 to Zero giving PRS-TABLE-MAX move 'PRS-TABLE-MAX set to 128' to Message-TEXT perform Z-Brandish-Message-TEXT end-if if PRS-BUFFER-SIZE not numeric add together 2048 to ZERO giving PRS-BUFFER-SIZE movement 'PRS-BUFFER-SIZE set to 2048' to Bulletin-TEXT perform Z-DISPLAY-Message-TEXT end-if if PRS-BUFFER-SIZE > 2048 add 2048 to ZERO giving PRS-BUFFER-SIZE move 'PRS-BUFFER-SIZE ready to 2048' to Message-TEXT perform Z-DISPLAY-MESSAGE-TEXT terminate-if exit. ***************************************************************** INITIALIZE-DEFAULT-VALUES. motion ',' to PRS-DELIMITER motion 'Y' to PRS-Space-TRUNCATION motion 'Y' to PRS-Go along-NULL-FIELDS add together 128 to ZERO giving PRS-Tabular array-MAX add 2048 to Cypher giving PRS-BUFFER-SIZE perform INITIALIZE-Table-ELEMENTS move '0' to PRS-REQUEST motion ZERO to PRS-Status move ZERO to PRS-NUMBER-OF-ITEMS move Zero to PRS-Terminal-SIG-BYTE exit. ***************************************************************** INITIALIZE-TABLE-ELEMENTS. move 1 to I-PTR move 1 to O-PTR perform until O-PTR > PRS-Tabular array-MAX motion 0 to PRS-POSITION(O-PTR) move 0 to PRS-SIZE(O-PTR) add 1 to O-PTR end-perform decrease RETURN-CODE from Render-CODE get out. ***************************************************************** PARSE-BUFFER. *! Initialize Position/Length tables to zippo (0). perform INITIALIZE-TABLE-ELEMENTS movement Nada to PRS-LAST-SIG-BYTE *! Parse the Buffer. add i to ZERO giving O-PTR perform until I-PTR > PRS-BUFFER-SIZE perform PARSE-BUFFER-10 end-perform * Wrap-up the parse of this buffer... if PRS-Concluding-SIG-BYTE > 0 and PRS-BUFFER(PRS-Last-SIG-BYTE:1) not = PRS-DELIMITER add 1 to PRS-NUMBER-OF-ITEMS end-if if PRS-POSITION(O-PTR) = 0 subtract 1 from O-PTR finish-if decrease RETURN-CODE from Return-Code exit. *---------------------------------------------------------------* PARSE-BUFFER-10. if PRS-BUFFER(I-PTR:one) not = Infinite add I-PTR to ZERO giving PRS-LAST-SIG-BYTE end-if if PRS-BUFFER(I-PTR:1) = PRS-DELIMITER add together 1 to B-COUNT if PRS-Go on-Cypher-FIELDS = 'Y' or B-COUNT = 1 and PRS-SIZE(O-PTR) > 0 if O-PTR < PRS-TABLE-MAX add ane to O-PTR add 1 to PRS-NUMBER-OF-ITEMS else move PRS-BUFFER-SIZE to I-PTR end-if end-if else subtract B-COUNT from B-COUNT add together 1 to PRS-SIZE(O-PTR) if PRS-SIZE(O-PTR) = 1 move I-PTR to PRS-POSITION(O-PTR) terminate-if end-if add 1 to I-PTR if PRS-TERMINATOR = 'Y' and I-PTR non > PRS-BUFFER-SIZE and PRS-BUFFER(I-PTR:one) = PRS-TERMINATOR-BYTE if PRS-SIZE(O-PTR) > 0 add 1 to PRS-NUMBER-OF-ITEMS terminate-if add PRS-BUFFER-SIZE to 1 giving I-PTR end-if get out. ***************************************************************** * Display CONSOLE messages... * ***************************************************************** Z-DISPLAY-MESSAGE-TEXT. if Bulletin-TEXT-2 = SPACES brandish Bulletin-BUFFER(1:79) else display MESSAGE-BUFFER finish-if move all SPACES to MESSAGE-TEXT leave. ***************************************************************** * This example is provided by SimoTime Technologies * * Our e-mail accost is: helpdesk@simotime.com * * Also, visit our Web Site at http://world wide web.simotime.com * *****************************************************************
The COBOL Copy Files
This section contains the listing for the copy files used by the programs in this example.
Record Layout or Structure
The post-obit (CUSTTXB1.cpy) is the tape layout of the cavalcade-oriented, stock-still-field-length, Customer Chief file.
***************************************************************** * CUSTTXB1.CPY - a COBOL Copy File * * A Customer Text File used by CSV Demo programs. * * Copyright (C) 1987-2019 SimoTime Technologies * * All Rights Reserved * * Provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Likewise, visit our Web Site at http://www.simotime.com * ***************************************************************** * The tape length is 512 bytes. * * Cavalcade Field Name Size * - ----------------------- -- * A CUSTTEXT-Cardinal 12 * B CUSTTEXT-Status 01 * C CUSTTEXT-Final-NAME 28 * D CUSTTEXT-FIRST-Name 20 * Eastward CUSTTEXT-STREET-ADDR-01 48 * F CUSTTEXT-STREET-ADDR-02 48 * G CUSTTEXT-Urban center 16 * H CUSTTEXT-STATE 02 * I CUSTTEXT-POSTAL-Code 12 * - ----------------------- -- * 01 CUSTTEXT-RECORD. 05 CUSTTEXT-Cardinal Moving picture 9(12). 05 CUSTTEXT-STATUS PIC X. 05 CUSTTEXT-LAST-Proper noun PIC X(28). 05 CUSTTEXT-Beginning-Name PIC X(xx). 05 CUSTTEXT-STREET-ADDR-01 PIC X(48). 05 CUSTTEXT-STREET-ADDR-02 Motion-picture show X(48). 05 CUSTTEXT-CITY Film X(16). 05 CUSTTEXT-STATE PIC X(2). 05 CUSTTEXT-POSTAL-Code PIC X(12). 05 FILLER PIC X(325). * *** CUSTTXB1 - Finish-of-Copy File - - - - - - - - - - - CUSTTXB1 * ***************************************************************** *
Pass Area of Parsing Program
The following (PASSPARS.cpy) is the layout of the pass area that is used when calling the parsing program.
***************************************************************** * Data Construction or Pass Area used for calling SIMOPARS. * ***************************************************************** * Copyright (C) 1987-2019 SimoTime Technologies * * All Rights Reserved * ***************************************************************** * Provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://world wide web.simotime.com * ***************************************************************** * * * PRS-REQUEST Blazon of request, must be zero (0) for * * parsing. This item is provided by the * * calling programme and is not modified * * by the parsing routine. * * PRS-Status This is an indicator as to the success * * or failure of the asking. A value of * * zero (0000) indicates the routine was * * successful. A non-zero value indicates * * a failure. * * * * ------------------------------------------------------------- * * The following fields are provided past the calling routine. * * * * PRS-DELIMITER This is a one byte graphic symbol that is * * used as a delimiter. This detail is * * provided by the calling program and * * is not modified by the parsing routine. * * * * PRS-KEEP-Nix-FIELDS This must be a Yes (Y) or No (North) value * * (Y) will indicate a Yes, go along nil field * * (North) will bespeak a No and null fields * * volition exist dropped. * * PRS-TERMINATOR This must be a Yes (Y) or No (N) value * * to indicate a grapheme that will exist * * used for termination of the parsing. * * If (Y) and then the next parameter is used * * as a termination character. If (Due north) the * * buffer volition be parsed according to the * * size of the buffer or maximum number * * of table entries. This detail is provided * * past the calling programme and is not * * modified by the parsing routine. * * PRS-TERMINATOR-BYTE If the previous parameter is (Y) this * * byte will be used to cease the * * parsing when it is encountered in the * * data string. This item is provided by * * the calling plan and is non modified * * by the parsing routine. * * * * PRS-BUFFER-SIZE The size of the data cord to be * * parsed and must exist a value of 1-1024. * * This detail is provided past the calling * * plan and is non modified past the * * parsing routine. * * PRS-BUFFER This is the data string or field that * * volition be parsed. This item is provided * * by the calling programme and is not * * modified past the parsing routine. * * * * PRS-Table-MAX The maximum number of tabular array entries * * available for the POSITION/SIZE values * * of the words in the input buffer. * * This item is provided past the calling * * program and is not modified by the * * parsing routine. * * * * ------------------------------------------------------------- * * The following fields are updated past the parsing routine. * * * * PRS-NUMBER-OF-ITEMS This is the number of keywords found * * in the input information cord. This particular is * * provided by the parsing routine. * * * * PRS-Concluding-SIG-BYTE This is the position of the final * * significant, not-delimiter byte. If the * * PRS-TERMINATOR is "Y" this volition exist the * * last significant byte before the * * terminator byte. * * * * PRS-POSITION This is a table of 64 elements of * * four-bytes. The value is either naught (0) * * or the position of a keyword within the * * input data string. The first position * * within the buffer is ane (1). * * This particular is provided by the parsing * * routine. * * PRS-SIZE This is a table of 64 elements of * * iv-bytes. The value is either zero (0) * * or the size of a keyword within the * * input data string. This item is provided * * past the parsing routine. * * * * ------------------------------------------------------------- * * NOTE... The table element number is the number * * of the word within the data buffer. * * The data buffer is PRS-BUFFER. * * For example, PRS-POSITION(1) would point * * to the position of the get-go grapheme * * of the first word in the information buffer * * PRS-SIZE(ane) would specify the number of * * characters in the first word. * * * ***************************************************************** 01 PRS-PARAMETERS. 05 PRS-Asking PIC X. 05 PRS-Condition PIC 9(4). *** Provided by the calling program... 05 PRS-DELIMITER PIC X. 05 PRS-KEEP-NULL-FIELDS PIC 10. 05 PRS-TERMINATOR Picture show X. 05 PRS-TERMINATOR-BYTE PIC X. 05 PRS-Space-TRUNCATION PIC Ten. 05 PRS-BUFFER-SIZE PIC 9(iv). 05 PRS-BUFFER PIC X(2048). 05 PRS-TABLE-MAX Picture nine(four). *** Updated by the parsing routine... 05 PRS-NUMBER-OF-ITEMS Pic 9(4). 05 PRS-LAST-SIG-BYTE Pic 9(4). 05 PRS-POSITION OCCURS 128 TIMES PIC 9(4). 05 PRS-SIZE OCCURS 128 TIMES Motion-picture show ix(4). *** PASSPARS - End-of-Re-create File - - - - - - - - - - - PASSPARS * ***************************************************************** *
Summary
The purpose of this program is to provide examples for accessing a comma-delimited file containing variable-length strings and creating a new column-oriented, fixed-field-length Sequential file. This certificate may be used to assistance as a tutorial for new programmers or as a quick reference for experienced programmers.
In the world of programming in that location are many ways to solve a problem. This documentation and software were adult and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or awarding processing across a diverseness of systems. For additional data well-nigh SIMOTIME Services or Technologies delight contact us using the data in the Contact, Comment or Feedback section of this document.
Software Agreement and Disclaimer
Permission to utilise, re-create, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or grooming material will be delivered and a license will exist granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in whatsoever advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.
SimoTime Technologies makes no warranty or representations near the suitability of the software, documentation or learning cloth for whatever purpose. It is provided "Every bit IS" without any expressed or implied warranty, including the implied warranties of merchantability, fettle for a particular purpose and not-infringement. SimoTime Technologies shall non be liable for whatsoever direct, indirect, special or consequential damages resulting from the loss of use, information or projects, whether in an activeness of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.
Downloads and Links
This section includes links to documents with boosted data that are across the scope and purpose of this document. The commencement grouping of documents may be available from a local arrangement or via an internet connection, the 2d group of documents will crave an net connection.
Note: A SimoTime License is required for the items to be made available on a local organisation or server.
Current Server or Internet Access
The following links may exist to the current server or to the Internet.
Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may exist available on a local server and accessed using the icon.
Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample lawmaking.
Explore the COBOL Connexion for more examples of COBOL programming techniques and sample code.
Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe Organisation were copied and deployed in a Microsoft Windows environs with Micro Focus Enterprise Server.
Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.
Explore The File Status Render Codes to translate the results of accessing VSAM information sets and/or QSAM files.
Net Access Required
The following links will require an net connect.
This suite of programs and documentation is available to download for review and evaluation purposes. Other uses volition require a SimoTime Software License. Link toan Evaluation zPAK Choice that includes the program members, documentation and control files.
A good identify to kickoff is The SimoTime Abode Page for access to white papers, programme examples and product information. This link requires an Internet Connexion
Explore The Micro Focus Spider web Site for more data most products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.
Explore the GnuCOBOL Technologies available from SourceForge. SourceForge is an Open Source community resource dedicated to helping open source projects be as successful as possible. GnuCOBOL (formerly OpenCOBOL) is a COBOL compiler with run fourth dimension support. The compiler (cobc) translates COBOL source to executable using intermediate C, designated C compiler and linker. This link will crave an Internet Connectedness.
Glossary of Terms
Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
Comments or Feedback
This document was created and is maintained by SimoTime Technologies and Services. If you lot have any questions, suggestions, comments or feedback please use the following contact information.
1. | Send an email to our helpdesk. |
2. | Our telephone numbers are every bit follows. |
2.one. | 1 415 763-9430 office-helpdesk |
ii.2. | i 415 827-7045 mobile |
We capeesh hearing from y'all.
Company Overview
SimoTime Technologies was founded in 1987 and is a privately endemic visitor. Nosotros specialize in the cosmos and deployment of business organisation applications using new or existing technologies and services. Nosotros accept a team of individuals that understand the wide range of technologies being used in today's environments. Our customers include small-scale businesses using Cyberspace technologies to corporations using very large mainframe systems.
Quite often, to reach larger markets or provide a higher level of service to existing customers information technology requires the newer Cyberspace technologies to piece of work in a complementary fashion with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a diverseness of platforms.
Preparing the application programs will crave the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and information management tasks involved with doing business in a multi-system environment.
Whether you want to utilize the Internet to aggrandize into new market segments or as a delivery vehicle for existing business functions simply requite usa a call or bank check the web site at http://world wide web.simotime.com
Return-to-Top |
Reading a Comma-Delimited File (CSV) with COBOL |
Copyright © 1987-2022 SimoTime Technologies and Services All Rights Reserved |
When technology complements business organisation |
http://www.simotime.com |
How to Read Csv Text File Into Numeric Record Cobol
Source: http://simotime.com/cblcsv02.htm
0 Response to "How to Read Csv Text File Into Numeric Record Cobol"
Post a Comment