![]() |
Data Extract Customer Master File |
| When technology complements business | Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
| The SimoTime Home Page |
This suite of sample programs describes how to extract data from the Customer Master File. The numeric fields will be expanded (Packed or Binary) and the trailing spaces within the text fields will be truncated. A new record will be constructed with the fields being concatenated and separated by a comma. The newly constructed record will be written to a sequential file. The file may now be transferred from the mainframe to a Windows system using the File Transfer Protocol (FTP) and easily imported into a Microsoft Excel spreadsheet, an Access Data Base or other SQL Data Bases.
The extract of data by fields within the record and the reformatting of the output records is actually accomplished with two COBOL programs. The first program does the File I/O of reading the Customer Master File and writing reformatted records to a sequential file. The File I/O program calls the second program to do the record formatting that expands the numeric fields and does blank truncation on the text fields and then places a comma between the fields as the field delimiter. The COBOL programs were generated using SimoTime technology.
When running this job on a Mainframe System the output file will be an EBCDIC-encoded, record-sequential file. The records will be concatenated fields of text strings separated (or delimited) by a comma. This file may be downloaded from the mainframe to a Windows system using FTP in ASCII mode. Since the output file is all text it will be properly converted from EBCDIC to ASCII during the file transfer (FTP) process. It will also be converted from a Record-Sequential file to a Line-Sequential file (Micro Focus terminology for ASCII/Text File). The file is now ready to import into an Excel spreadsheet, an Access Data Base or other SQL Data Bases.
When running the job on a Windows System with Micro Focus and using EBCDIC encoding the output file will be an EBCDIC-encoded, record-sequential file. The records will be concatenated fields of text strings separated (or delimited) by a comma. Since we no longer use the FTP process to transfer the file we no longer have the benefit of the FTP process doing the file-format and file-content conversion. Therefore, we need an alternative method for doing the file format conversion from record-sequential to line-sequential and the file content conversion from EBCDIC to ASCII. Refer to the File-Format and File-Content Conversion Program for more information.
When running the job on a Windows System with Micro Focus and using ASCII encoding the output file will be an ASCII-encoded, record-sequential file. The records will be concatenated fields of text strings separated (or delimited) by a comma. Since we no longer use the FTP process to transfer the file and we no longer have the benefit of the FTP process doing the file-format conversion (since we are running in an ASCII-encoded configuration the file-content conversion is not a requirement). Therefore, we need an alternative method for doing the file format conversion from record-sequential to line-sequential. Refer to the File-Format Conversion Program for more information.
This document provides a brief oveview of the Micro Focus File Formats available on Linux, UNIX or Windows Systems supported by Micro Focus.
The term Mainframe-Oriented refers to an actual IBM Mainframe, Micro Focus Mainframe Express or Micro Focus Enterprise Server with the Mainframe Transaction Option and the Batch Facility. The following (CUEXTJ01.JCL) is a listing of the JCL member needed to run this job.
//CUSEXTJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This JCL Member is provided by SimoTime Enterprises * //* (C) Copyright 1987-2012 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Text - Read Customer Master File, write to a sequential file //* Author - SimoTime Enterprises //* Date - January 01, 1989 //* //* This set of programs will run on a mainframe under MVS or on //* a Personal Computer running Windows and Mainframe Express by //* Micro Focus. //* //* ************ ************ //* * Entry * * Entry * //* * MVS * * Windows * //* ************ ************ //* * * //* ************ ************ //* * CUSEXTJ1 * * CUSEXTE1 * //* ********jcl* ********cmd* //* * * //* ************ * //* * IEFBR14 * * //* ********utl* * //* * * //* ********************************* //* * //* * //* ************ ************ ************ //* * CUSTMAST *----* CUSEXTC1 *----* CUSEXTSV * //* ************ ********cbl* ********dat* //* * * //* * * //* * *---CALL----* //* * * //* * * //* * ************ //* * * CUSEXTR1 * //* * ********cbl* //* * //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 of 2, This job step will delete a previously created file. //* //DELTSEQ1 EXEC PGM=IEFBR14 //CUSTRCSV DD DSN=SIMOTIME.DATA.CUSTPHON,DISP=(MOD,DELETE,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=256,DSORG=PS) //* ******************************************************************* //* Step 2 of 2, Execute the Sample program. //* Read the customer file (KSDS) and write a record of //* selected fields to a sequential file. Truncate spaces //* from each field and separate the fields by a comma. //* //CBLEXTS1 EXEC PGM=CUSEXTC1 //STEPLIB DD DSN=MFI01.SIMOPROD.LOADLIB1,DISP=SHR //CUSTMAST DD DSN=SIMOTIME.DATA.CUSTMAST,DISP=SHR //CUSTRCSV DD DSN=SIMOTIME.DATA.CUSTPHON,DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=256,DSORG=PS) //SYSOUT DD SYSOUT=* //*
The following (CUSEXTR1.CBL) is the COBOL I/O program that was generated with SimoTime technology. The program was tested using Micro Focus Enterprise Server on Windows/XP. The program was successfully executed in both an EBCDIC and ASCII encoded configuration.
IDENTIFICATION DIVISION.
PROGRAM-ID. CUSEXTC1.
AUTHOR. SIMOTIME ENTERPRISES.
*****************************************************************
* This program was generated by SimoZAPS *
* A product of SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2011-01-31 Generation Time: 15:47:09:31 *
* *
* Record Record Key *
* Function Name Organization Format Max-Min Pos-Len *
* INPUT CUSTMAST INDEXED VARIABLE 00512 00001 *
* 00012 00012 *
* OUTPUT CUSTRCSV SEQUENTIAL FIXED 00256 *
* *
* *
*****************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CUSTMAST-FILE ASSIGN TO CUSTMAST
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
RECORD KEY IS CUSTMAST-PKEY-00001-00012
FILE STATUS IS CUSTMAST-STATUS.
SELECT CUSTRCSV-FILE ASSIGN TO CUSTRCSV
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS CUSTRCSV-STATUS.
*****************************************************************
DATA DIVISION.
FILE SECTION.
FD CUSTMAST-FILE
DATA RECORD IS CUSTMAST-REC
.
01 CUSTMAST-REC.
05 CUSTMAST-PKEY-00001-00012 PIC X(00012).
05 CUSTMAST-DATA-00013-00500 PIC X(00500).
FD CUSTRCSV-FILE
DATA RECORD IS CUSTRCSV-REC
.
01 CUSTRCSV-REC.
05 CUSTRCSV-DATA-01 PIC X(00256).
*****************************************************************
* 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 between EBCDIC and ASCII. For more *
* information or questions contact SimoTime Enterprises. *
* *
* Our e-mail 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 program mask is used with a callable subroutine that *
* will do ASCII/EBCDIC Conversion based on a COBOL Copy File. *
* *
* If the output file is indexed then the input file must be in *
* sequence by the field that will be used to provide the key *
* for the output file. *
* *
* If the key field is not in sequence then refer to SYSMASK4 *
* to provide for a random add or update of the indexed file. *
*****************************************************************
WORKING-STORAGE SECTION.
01 SIM-TITLE.
05 T1 pic X(11) value '* CUSEXTC1 '.
05 T2 pic X(34) value 'Extract Customer Info to CSV RSEQ '.
05 T3 pic X(10) value ' v10.07.06'.
05 T4 pic X(24) value ' helpdesk@simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* CUSEXTC1 '.
05 C2 pic X(32) value 'This Data File Convert Member wa'.
05 C3 pic X(32) value 's generated by SimoTime Technolo'.
05 C4 pic X(04) value 'gies'.
01 CUSTMAST-STATUS.
05 CUSTMAST-STATUS-L pic X.
05 CUSTMAST-STATUS-R pic X.
01 CUSTMAST-EOF pic X value 'N'.
01 CUSTMAST-OPEN-FLAG pic X value 'C'.
01 CUSTRCSV-STATUS.
05 CUSTRCSV-STATUS-L pic X.
05 CUSTRCSV-STATUS-R pic X.
01 CUSTRCSV-EOF pic X value 'N'.
01 CUSTRCSV-OPEN-FLAG pic X value 'C'.
01 CUSTMAST-LRECL pic 9(5) value 00512.
01 CUSTRCSV-LRECL pic 9(5) value 00256.
*****************************************************************
* The following buffers are used to create a four-byte status *
* code that may be displayed. *
*****************************************************************
01 IO-STATUS.
05 IO-STAT1 pic X.
05 IO-STAT2 pic X.
01 IO-STATUS-04.
05 IO-STATUS-0401 pic 9 value 0.
05 IO-STATUS-0403 pic 999 value 0.
01 TWO-BYTES-BINARY pic 9(4) BINARY.
01 TWO-BYTES-ALPHA redefines TWO-BYTES-BINARY.
05 TWO-BYTES-LEFT pic X.
05 TWO-BYTES-RIGHT pic X.
*****************************************************************
* Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. *
*****************************************************************
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '* CUSEXTC1 '.
05 MESSAGE-TEXT.
10 MESSAGE-TEXT-1 pic X(68) value SPACES.
10 MESSAGE-TEXT-2 pic X(188) value SPACES.
*****************************************************************
01 PROGRAM-NAME pic X(8) value 'CUSEXTC1'.
01 INFO-STATEMENT.
05 INFO-SHORT.
10 INFO-ID pic X(8) value 'Starting'.
10 filler pic X(2) value ', '.
10 filler pic X(34)
value 'Extract Customer Info to CSV RSEQ '.
05 filler pic X(24)
value ' http://www.SimoTime.com'.
01 APPL-RESULT pic S9(9) comp.
88 APPL-AOK value 0.
88 APPL-EOF value 16.
01 CUSTMAST-TOTAL.
05 CUSTMAST-RDR pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(23) value 'Line count for CUSTMAST'.
01 CUSTRCSV-TOTAL.
05 CUSTRCSV-ADD pic 9(9) value 0.
05 filler pic X(3) value ' - '.
05 filler pic X(23) value 'Line count for CUSTRCSV'.
*****************************************************************
PROCEDURE DIVISION.
move all '*' to MESSAGE-TEXT-1
perform Z-DISPLAY-MESSAGE-TEXT
move INFO-STATEMENT to MESSAGE-TEXT-1
perform Z-DISPLAY-MESSAGE-TEXT
move all '*' to MESSAGE-TEXT-1
perform Z-DISPLAY-MESSAGE-TEXT
perform Z-POST-COPYRIGHT
perform CUSTMAST-OPEN
perform CUSTRCSV-OPEN
perform until CUSTMAST-STATUS not = '00'
perform CUSTMAST-READ
if CUSTMAST-STATUS = '00'
add 1 to CUSTMAST-RDR
perform BUILD-OUTPUT-RECORD
perform CUSTRCSV-WRITE
if CUSTRCSV-STATUS = '00'
add 1 to CUSTRCSV-ADD
end-if
end-if
end-perform
move CUSTMAST-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move CUSTRCSV-TOTAL to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
if APPL-EOF
move 'Complete' to INFO-ID
else
move 'ABENDING' to INFO-ID
end-if
move INFO-STATEMENT to MESSAGE-TEXT(1:79)
perform Z-DISPLAY-MESSAGE-TEXT
perform CUSTRCSV-CLOSE
perform CUSTMAST-CLOSE
GOBACK.
*****************************************************************
BUILD-OUTPUT-RECORD.
*> Extract CALL process...
call 'CUSEXTR1' using CUSTRCSV-REC
CUSTMAST-REC
add 00256 to ZERO giving CUSTRCSV-LRECL
exit.
*****************************************************************
* I/O Routines for the INPUT File... *
*****************************************************************
CUSTMAST-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close CUSTMAST-FILE
if CUSTMAST-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with CUSTMAST' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move CUSTMAST-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
CUSTMAST-READ.
read CUSTMAST-FILE
if CUSTMAST-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if CUSTMAST-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if
if APPL-AOK
CONTINUE
else
if APPL-EOF
move 'Y' to CUSTMAST-EOF
else
move 'READ Failure with CUSTMAST' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move CUSTMAST-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
end-if
exit.
*---------------------------------------------------------------*
CUSTMAST-OPEN.
add 8 to ZERO giving APPL-RESULT.
open input CUSTMAST-FILE
if CUSTMAST-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to CUSTMAST-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with CUSTMAST' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move CUSTMAST-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* I/O Routines for the OUTPUT File... *
*****************************************************************
CUSTRCSV-WRITE.
if CUSTRCSV-OPEN-FLAG = 'C'
perform CUSTRCSV-OPEN
end-if
write CUSTRCSV-REC
if CUSTRCSV-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
else
if CUSTRCSV-STATUS = '10'
add 16 to ZERO giving APPL-RESULT
else
add 12 to ZERO giving APPL-RESULT
end-if
end-if.
if APPL-AOK
CONTINUE
else
move 'WRITE Failure with CUSTRCSV' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move CUSTRCSV-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
CUSTRCSV-OPEN.
add 8 to ZERO giving APPL-RESULT.
open OUTPUT CUSTRCSV-FILE
if CUSTRCSV-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'O' to CUSTRCSV-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'OPEN Failure with CUSTRCSV' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move CUSTRCSV-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*---------------------------------------------------------------*
CUSTRCSV-CLOSE.
add 8 to ZERO giving APPL-RESULT.
close CUSTRCSV-FILE
if CUSTRCSV-STATUS = '00'
subtract APPL-RESULT from APPL-RESULT
move 'C' to CUSTRCSV-OPEN-FLAG
else
add 12 to ZERO giving APPL-RESULT
end-if
if APPL-AOK
CONTINUE
else
move 'CLOSE Failure with CUSTRCSV' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
move CUSTRCSV-STATUS to IO-STATUS
perform Z-DISPLAY-IO-STATUS
perform Z-ABEND-PROGRAM
end-if
exit.
*****************************************************************
* The following Z-ROUTINES provide administrative functions *
* for this program. *
*****************************************************************
* ABEND the program, post a message to the console and issue *
* a STOP RUN. *
*****************************************************************
Z-ABEND-PROGRAM.
if MESSAGE-TEXT not = SPACES
perform Z-DISPLAY-MESSAGE-TEXT
end-if
move 'PROGRAM-IS-ABENDING...' to MESSAGE-TEXT
perform Z-DISPLAY-MESSAGE-TEXT
add 12 to ZERO giving RETURN-CODE
STOP RUN.
* exit.
*****************************************************************
* Display CONSOLE messages... *
*****************************************************************
Z-DISPLAY-MESSAGE-TEXT.
if MESSAGE-TEXT-2 = SPACES
display MESSAGE-BUFFER(1:79)
else
display MESSAGE-BUFFER
end-if
move all SPACES to MESSAGE-TEXT
exit.
*****************************************************************
* Display the file status bytes. This routine will display as *
* four digits. If the full two byte file status is numeric it *
* will display as 00nn. If the 1st byte is a numeric nine (9) *
* the second byte will be treated as a binary number and will *
* display as 9nnn. *
*****************************************************************
Z-DISPLAY-IO-STATUS.
if IO-STATUS not NUMERIC
or IO-STAT1 = '9'
move IO-STAT1 to IO-STATUS-04(1:1)
subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
move IO-STAT2 to TWO-BYTES-RIGHT
add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-MESSAGE-TEXT
else
move '0000' to IO-STATUS-04
move IO-STATUS to IO-STATUS-04(3:2)
move 'File Status is: nnnn' to MESSAGE-TEXT
move IO-STATUS-04 to MESSAGE-TEXT(17:4)
perform Z-DISPLAY-MESSAGE-TEXT
end-if
exit.
*****************************************************************
Z-POST-COPYRIGHT.
display SIM-TITLE
display SIM-COPYRIGHT
exit.
*****************************************************************
* This program was generated by SimoZAPS *
* A product of SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* *
* Generation Date: 2011-01-31 Generation Time: 15:47:09:34 *
*****************************************************************
The following (CUSEXTR1.CBL) is a COBOL program that extracts the fields of data and expands the numeric fields and truncates the trailing spaces from text fields and builds a comma separated text string of data. The program was tested using Micro Focus Enterprise Server on Windows/XP. The program was successfully executed in both an EBCDIC and ASCII encoded configuration.
IDENTIFICATION DIVISION.
PROGRAM-ID. CUSEXTR1.
AUTHOR. SIMOTIME ENTERPRISES.
*****************************************************************
* This routine was generated by SimoREC1 *
* A product of SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* Generation Date: 2011/01/31 Generation Time: 15:47:09:60 *
*****************************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NGPU-07-00.
05 NRPU-07-00 pic 9(07).
01 IX-P1 pic 9(9) value 0.
01 IX-P2 pic 9(9) value 0.
01 IX-NP pic 9(5) value 0.
01 IX-L1 pic 9(9) value 0.
01 RA-P1 pic 9(3) value 0.
01 RA-P2 pic 9(3) value 0.
01 COLUMN-NUMBER pic 9(5) value 0.
01 WORK-AREA-X.
05 WORK-AREA-X1 pic X value '"'.
05 WORK-AREA pic X(00288) value SPACES.
01 WORK-AREA-X2 pic X(00256) value SPACES.
01 FRAME-STOP.
05 FRAME-BYTE pic X value '"'.
05 DELIMITER-BYTE pic X value ','.
01 FRAME-FLAG pic X value 'N'.
01 O-FLAG pic X(3) value 'CSV'.
01 BYTE-Y pic X value 'Y'.
01 BYTE-N pic X value 'N'.
01 FRAME-COUNT pic 9(5) value 0.
01 DELIM-COUNT pic 9(5) value 0.
01 FFL-SIZE pic 9(5) value 0.
01 CSV-SIZE pic 9(5) value 0.
01 LAST-NON-SPACE-BYTE pic 9(5) value 0.
01 SIGN-BYTE pic X value SPACE.
01 DIG-POS pic 9(3).
01 DIG-LEN pic 9(3).
01 DIG-CTL pic 9(3).
01 DEC-POS pic 9(3).
01 DEC-LEN pic 9(3).
01 DEC-CTL pic 9(3).
01 DEC-POINT pic 9(3).
*
*****************************************************************
LINKAGE SECTION.
01 REC1CALL-REC pic X(00256).
COPY CUSTCB01.
*
*****************************************************************
PROCEDURE DIVISION using REC1CALL-REC
CUST-RECORD.
*
add 1 to ZERO giving IX-NP
move all SPACES
to REC1CALL-REC
*
* String Move, CUST-NUMBER
add 00012 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-NUMBER to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-STATUS
add 00001 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-STATUS to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-LAST-NAME
add 00028 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-LAST-NAME to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-FIRST-NAME
add 00020 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-FIRST-NAME to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-MID-NAME
add 00020 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-MID-NAME to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-ADDRESS-1
add 00048 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-ADDRESS-1 to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-ADDRESS-2
add 00048 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-ADDRESS-2 to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-CITY
add 00028 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-CITY to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-STATE
add 00028 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-STATE to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-POSTAL-CODE
add 00012 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-POSTAL-CODE to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-PHONE-HOME
add 00018 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-PHONE-HOME to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-PHONE-WORK
add 00018 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-PHONE-WORK to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* String Move, CUST-PHONE-CELL
add 00018 to ZERO giving FFL-SIZE
move SPACES to WORK-AREA-X2
move CUST-PHONE-CELL to WORK-AREA-X2
perform POST-TEXT-TO-CSV
*
* Packed-UnSign move, CUST-CREDIT-LIMIT
add 00007 to ZERO giving FFL-SIZE
if CUST-CREDIT-LIMIT is NUMERIC
add CUST-CREDIT-LIMIT to ZERO giving NRPU-07-00
else
move ZERO to NRPU-07-00
end-if
move SPACES to WORK-AREA-X2
move NGPU-07-00 to WORK-AREA-X2
perform POST-TEXT-TO-CSV
GOBACK.
*
*****************************************************************
POST-TEXT-TO-CSV.
* This routine does a left-to-right scan of the content
* of a fixed-field. It accumulates counters for the
* embedded Frame or Delimiter bytes.
* If embedded Frame or Delimiters bytes exist in the
* text string within a field then the text string will
* be formated as it is moved to the output buffer.
* The data in the output buffer will start and end with
* a Frame byte
* Embedded Frame bytes will be preceded by a Frame byte
* and embedded Delimiter bytes will be treated as data
* within the output text string.
*****************************************************************
add 1 to ZERO giving IX-P1
add 1 to ZERO giving IX-P2
move ZERO to FRAME-COUNT
move ZERO to DELIM-COUNT
move ZERO to LAST-NON-SPACE-BYTE
move SPACES to WORK-AREA
perform until IX-P1 > FFL-SIZE
move WORK-AREA-X2(IX-P1:1) to WORK-AREA(IX-P2:1)
if WORK-AREA-X2(IX-P1:1) = FRAME-BYTE
add 1 to IX-P2
add 1 to FRAME-COUNT
move FRAME-BYTE to WORK-AREA(IX-P2:1)
end-if
if WORK-AREA-X2(IX-P1:1) = DELIMITER-BYTE
add 1 to DELIM-COUNT
end-if
if WORK-AREA-X2(IX-P1:1) not = SPACE
add IX-P2 to ZERO giving LAST-NON-SPACE-BYTE
end-if
add 1 to IX-P1
add 1 to IX-P2
end-perform
if DELIM-COUNT > 0
or FRAME-COUNT > 0
add 1 to LAST-NON-SPACE-BYTE
move FRAME-BYTE to WORK-AREA(LAST-NON-SPACE-BYTE:1)
add 1 to IX-P2
add LAST-NON-SPACE-BYTE to 1 giving CSV-SIZE
move WORK-AREA-X to REC1CALL-REC(IX-NP:CSV-SIZE)
else
add LAST-NON-SPACE-BYTE to ZERO giving CSV-SIZE
move WORK-AREA to REC1CALL-REC(IX-NP:CSV-SIZE)
end-if
add CSV-SIZE to IX-NP
move DELIMITER-BYTE to REC1CALL-REC(IX-NP:1)
add 1 to IX-NP
exit.
*****************************************************************
* This routine was generated by SimoREC1 *
* A product of SimoTime Enterprises *
* Our e-mail address is: helpdesk@simotime.com *
* Also, visit our Web Site at http://www.simotime.com *
* Generation Date: 2011/01/31 Generation Time: 15:47:09:60 *
*****************************************************************
The purpose of this program is to provide an example for accessing a VSAM, KSDS and extracting data that is reformatted into a comma separated data string that is written to a sequential file.
This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers. In the world of programming there are many ways to solve a problem. This document and the links to other documents are intended to provide a choice of alternatives.
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will 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 any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.
SimoTime Enterprises makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, 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, documentation or training material.
This section includes links to documents with additional information that is beyond the scope and purpose of this document. The first sub-section requires an internet connection, the second sub-section references locally available documents.
Note: A SimoTime License is required for the items to be made available on a local server.
The following links will require an internet connect.
A good place to start is The SimoTime Home Page for access to white papers, program examples and product information.
This suite of programs and documentation is available for download. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.
Explore the User Guide for the SIMOZAPS Utility Program. This program has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.
Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.
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 Return Codes to interpret the results of accessing VSAM data sets and QSAM files.
Explore The Micro Focus Web Site for more information about products and services available from Micro Focus.
The following links may be accessible without an internet connection.
Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and QSAM files.
Check out The SimoTime Glossary for a list of terms and definitions used in the documents provided by SimoTime.
This document was created and is maintained by SimoTime Enterprises.
If you have any questions, suggestions, comments or feedback please call or send an e-mail to: helpdesk@simotime.com
We appreciate hearing from you.
Founded in 1987, SimoTime Enterprises is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems.
Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com
| Return-to-Top |
| Extract Data from Customer Master File for use by Microsoft Excel or Access |
| Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |