2

I am coding in cobol85, I have an input file having 2 records as of now

""1";"S";"20140211095016";;;;;"KANATA";"ON";"K2V 1A5";"ZR1
;;;;;;;;;;"-503.15";;"1715.27";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"26696.33
";"78.22";"3275.95";;;;;"30050.50";;" 
""1";"S";"20140211088445";;;;;"MANATA";"ON";"K2V 1A5";"ZR1
;;;;;;;;;;"-503.15";;"1715.27";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"26696.33
";"78.22";"3275.95";;;;;"30350.50";;" 

I am reading this input record and I want to put each record into different variables as of no into two different variables by inspecting carriage return or/and line feed but how can I do it I tried using "X'ODOA' but I couldn't separate it. Please help me how should I inspect and separate the records.

Michael
  • 57,169
  • 9
  • 80
  • 125

1 Answers1

1

I am asuming the first record finishes at "30050.50";;" and the second one starts at ""1";"S"

If those are two separate records on a sequential file you don't need to inspect for CR or LF as each READ will read a new line.

Can you post the SELECT and FD of that file?

Molusco
  • 59
  • 6
  • Yes Molusco your undersatnding for the records starting and ending is correct. SELECT CPC-INVOICE-FILE ASSIGN TO TB9002D1 ACCESS MODE IS SEQUENTIAL ORGANIZATION IS SEQUENTIAL FILE STATUS IS WS-CPC-FILE-STATS. FD CPC-INVOICE-FILE LABEL RECORDS ARE OMITTED. 01 CPC-INVOICE-RECORD PIC X(3530). And the input file is unstructured file. – Mohammed Baseet Jun 24 '15 at 06:50
  • as it is 01 CPC-INVOICE-RECORD PIC X(3530) I am getting complete input data in this variable and then I am using INSPECT command INSPECT CPC-INVOICE-RECORD TALLYING WS-TALL-CNT FOR ALL LINE-FEED still this inspect command is not checking for line feed or carriage return. Please help. – Mohammed Baseet Jun 24 '15 at 11:04
  • as of now my CPC-INVOICE-RECORD contains ""1";"S";"20140211095016";;;;;"KANATA";"ON";"K2V 1A5";"ZR1 ;;;;;;;;;;"-503.15";;"1715.27";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"26696.33 ";"78.22";"3275.95";;;;;"30050.50";;" "?13 ?10 " ""1";"S";"20140211088445";;;;;"MANATA";"ON";"K2V 1A5";"ZR1 ;;;;;;;;;;"-503.15";;"1715.27";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"26696.33 ";"78.22";"3275.95";;;;;"30350.50";;" "?13 ?10 " – Mohammed Baseet Jun 24 '15 at 15:14
  • And what was your approach to read the file? A `READ NEXT` loop? Can you post that too? I still don't think it is clear what are you trying to parse, as i told you, the `READ`s do it normally. – Molusco Jun 25 '15 at 13:25