REBOL for COBOL programmers |
nachalist introduction
Date written: October 17, 2012 This describes a sample program to list a "NACHA" file, which is a text file in a particular format, used for sending money to or collecting money from a bank. OverviewThis is a typical old-time COBOL application, listing a file. In the past it would have been listed on paper. This time, we will "list" it in a web page and view it in a web browser. This sample program will be a working sample program, but it will not be complete, as in doing everything you might expect a full-featured program to do. It was written originally to list the indicated file, so that's all it does. A full-featured general-purpose program might have features to write such a file also, but that was not in the original specifications. There was no need, at the time of writing, to do anything but read the file, so that's all the program does. There was no attempt to add unwanted features to the program just to make a complete demo. So, what you will happen when you run the program is, you will get a request box to select a file, and then a list of the file will pop up in a web browser, and that is all. File formatThe file is a little more complicated than just a text file of records that are all the same. There are several record types, as in a couple types of header records, a couple types of trailer records, and detail records. Exactly what they are used for is not important for this example, which is just going to list them. A description of the file follows. Since it does not matter, for this example, exactly how the fields are used, the description will be abbreviated, showing basically just what the record types are and what the fields are for each record type. For the curious, google "nacha file format" and you will find lots of information about this file format.
Record type 1, file header Position Size Contents Description -------- ---- -------- ------------------------------- 01-01 1 "1" Record type code 02-03 2 "01" Priority code 04-13 10 Bxxxxxxxxx Immediate destination (B=blank) 14-23 10 Immediate origin 24-29 6 YYMMDD File creation date 30-33 4 HHMM File creation time 34-34 1 File ID modifier 35-37 3 094 Record size 38-39 2 10 Blocking factor 40-40 1 "1" Format code 41-63 23 Destination name 64-86 23 Origin name 87-94 8 blank Reference code Record type 5, batch header Position Size Contents Description -------- ---- -------- ------------------------------- 01-01 1 "5" Record type code 02-04 3 Service class code 05-20 16 Company name 21-40 20 Company discretionary data 41-50 10 Company ID 51-53 3 Standard entry class code 54-63 10 Company entry description 64-69 6 YYMMDD Company descriptive date 70-75 6 YYMMDD Effective entry date 76-78 3 blank Settlement date 79-79 1 "1" Originator status code 80-87 8 Originating DFI identification 88-94 7 Batch number Record type 6, detail record Position Size Contents Description -------- ---- -------- ------------------------------- 01-01 1 "6" Record type code 02-03 2 Transaction code 04-12 9 Receiving DFI identification 13-29 17 DFI account number 30-39 10 9(8)v99 Amount 40-54 15 Individual ID number 55-76 22 Individual name 77-78 2 Discretionary data 79-79 1 "0" or "1" Addenda record indicator 80-94 15 Trace number Record type 8, batch trailer Position Size Contents Description -------- ---- -------- ------------------------------- 01-01 1 "8" Record type code 02-04 3 Service class code 05-10 6 Entry/Addenda count 11-20 10 Entry hash 21-32 12 9(10)V99 Total debit entry amount 33-44 12 9(10)V99 Total credit entry amount 45-54 10 Company ID 55-73 19 Message authentication code 74-79 6 blank Reserved 80-87 8 Orininating DFI identification 88-94 7 Batch number Record type 9, file trailer Position Size Contents Description -------- ---- -------- ------------------------------- 01-01 1 "9" Record type code 02-07 6 Batch count 08-13 6 Block count 14-21 8 Entry/addenda count 22-31 10 Entry hash 32-43 12 9(10)V99 Total debit entry amount 44-55 12 9(10)V99 Total credit entry amount 56-94 39 blank Reserved |