Creating a Pipe Delimited File
Posted: Mon Jan 30, 2012 5:55 pm
Currently I am working on setting up a pipe delimited download file. The file will then be used by a reporting application at my company and stored in SQL. The application will identify the pipes then separate and move the data to the tables. However I’m still pretty new to a lot of this and am having a little bit of a challenge setting this one up. So to the interwebs I have gone!
(I hope this makes sense as I am still learning some of the terminology/process flows – I further realize this may kind of be “well duh†information, but again I’m new to a lot of this.)
My question is how would I set it up so that the data is delimited after the file containg the data is read? Would I modify the copybook so that when the data is read and moved into that CPY the delimitation is set up there? Or would the delimitation occur during the perform/move process in the source/program code – or other? Sorry if this is vague, I was unsure how to word.
If you need anymore information or better clarification on something please let me know. I realize I may have something worded incorrectly/vaguely because of a lack of student experience. Just let me know and I’ll do my best to provide it.
*Information has been modified to show and example of my data layout but not actual values to protect company rights/privacy*
Copybook
01 STR-ORACLE-DETAIL-RECORD.
03 STR-RECORD-TYPE PIC X(1).
88 STR-DETAIL-RECORD VALUE '1'.
03 STR-DATA-TYPE PIC X(1).
03 STR-PRE-SUBSTITUTION-DATA.
05 STR-DATA1 PIC X(1).
05 STR-DATA2 PIC X(4).
05 STR-DATA3 PIC X(5).
05 STR-DATA4 PIC X(3).
05 STR-DATA5 PIC X(3).
05 STR-DATA6 PIC X.
05 STR-DATA7 PIC X(3).
05 STR-DATA8 PIC X.
05 STR-DATA9 PIC 9(3).
05 STR-DATA10 PIC 9(3).
05 STR-DATA11 PIC +9(11)V9(2).
05 STR-DATA12 PIC +9(11)V9(2).
05 STR-DATA13 PIC +9(11)V9(2).
05 FILLER PIC X(15).
03 STR-PRE-SUBSTITION-DATA.
05 STR-QUARTER-DIV PIC X(1).
05 STR-PST-DIV PIC +9(11)V9(2).
ETC….
Source
PERFORM L100-READ-DETAIL-FILE.
IF WS-END-OF-DETAIL-FILE
GO TO A200-EXIT.
MOVE SPACES TO STR-ORACLE-DETAIL-RECORD.
MOVE SEC-RECORD-TYPE TO STR-RECORD-TYPE
MOVE SEC-DATA-TYPE TO STR-DATA-TYPE
MOVE SEC-VALUE1 TO STR-DATA2
MOVE SEC-VALUE2 TO STR-DATA3
MOVE SEC-VALUE3 TO STR-DATA4
MOVE SEC-VALUE4 TO STR-DATA5
MOVE SEC-VALUE5 TO STR-DATA6
ETC…Continues…PERFORM L200-WRITE-ORACLE-DETAIL.
Example of data to be read: (Current Detail File)
1P1010020000010074A001Q010295L0A6…… +414+0000000003892 +00 ….. Continues >>>>>
Each record continues as a massively long row (periods are not part of data, just used to show further data sample.
Any assitance you may be able to provide is greatly appriciated. Thanks in advance.
(I hope this makes sense as I am still learning some of the terminology/process flows – I further realize this may kind of be “well duh†information, but again I’m new to a lot of this.)
My question is how would I set it up so that the data is delimited after the file containg the data is read? Would I modify the copybook so that when the data is read and moved into that CPY the delimitation is set up there? Or would the delimitation occur during the perform/move process in the source/program code – or other? Sorry if this is vague, I was unsure how to word.
If you need anymore information or better clarification on something please let me know. I realize I may have something worded incorrectly/vaguely because of a lack of student experience. Just let me know and I’ll do my best to provide it.
*Information has been modified to show and example of my data layout but not actual values to protect company rights/privacy*
Copybook
01 STR-ORACLE-DETAIL-RECORD.
03 STR-RECORD-TYPE PIC X(1).
88 STR-DETAIL-RECORD VALUE '1'.
03 STR-DATA-TYPE PIC X(1).
03 STR-PRE-SUBSTITUTION-DATA.
05 STR-DATA1 PIC X(1).
05 STR-DATA2 PIC X(4).
05 STR-DATA3 PIC X(5).
05 STR-DATA4 PIC X(3).
05 STR-DATA5 PIC X(3).
05 STR-DATA6 PIC X.
05 STR-DATA7 PIC X(3).
05 STR-DATA8 PIC X.
05 STR-DATA9 PIC 9(3).
05 STR-DATA10 PIC 9(3).
05 STR-DATA11 PIC +9(11)V9(2).
05 STR-DATA12 PIC +9(11)V9(2).
05 STR-DATA13 PIC +9(11)V9(2).
05 FILLER PIC X(15).
03 STR-PRE-SUBSTITION-DATA.
05 STR-QUARTER-DIV PIC X(1).
05 STR-PST-DIV PIC +9(11)V9(2).
ETC….
Source
PERFORM L100-READ-DETAIL-FILE.
IF WS-END-OF-DETAIL-FILE
GO TO A200-EXIT.
MOVE SPACES TO STR-ORACLE-DETAIL-RECORD.
MOVE SEC-RECORD-TYPE TO STR-RECORD-TYPE
MOVE SEC-DATA-TYPE TO STR-DATA-TYPE
MOVE SEC-VALUE1 TO STR-DATA2
MOVE SEC-VALUE2 TO STR-DATA3
MOVE SEC-VALUE3 TO STR-DATA4
MOVE SEC-VALUE4 TO STR-DATA5
MOVE SEC-VALUE5 TO STR-DATA6
ETC…Continues…PERFORM L200-WRITE-ORACLE-DETAIL.
Example of data to be read: (Current Detail File)
1P1010020000010074A001Q010295L0A6…… +414+0000000003892 +00 ….. Continues >>>>>
Each record continues as a massively long row (periods are not part of data, just used to show further data sample.
Any assitance you may be able to provide is greatly appriciated. Thanks in advance.