I am trying to create a sequential file that does not have carriage returns in it (for ACA XML reporting).
This is my Select Statement:
SELECT MANIFEST
ASSIGN TO RANDOM WS-MANIFEST-FILE
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS MANIFEST-STATUS.
This is my FD:
FD MANIFEST
LABEL RECORD IS STANDARD
RECORD IS VARYING IN SIZE FROM 1 TO 2000 CHARACTERS
DEPENDING ON WS-MANIFEST-CNT
VALUE OF LABEL IS WS-MANIFEST-FILE.
01 MANIFEST-REC.
05 MANIFEST-LINE PIC X(2000).
This is my routine to write to the file:
WRITE-MANIFEST-XML.
MOVE ZEROES TO WS-MANIFEST-CNT.
PERFORM VARYING WS-MANIFEST-CNT FROM 2000 BY -1
UNTIL MANIFEST-LINE(WS-MANIFEST-CNT:1) NOT = SPACES
CONTINUE
END-PERFORM.
WRITE MANIFEST-REC.
This is my output. The program is throwing random stuff in front of each record. I've debugged my program, and this stuff isn't being added in the program. Does anyone know how I can get rid of it? Or where it is coming from in the first place?

Amy, your COBOL has described a binary, variable record length sequential file. The characters you describe are not goofy or random, but rather are the record length indicators which are described briefly on page 248 of the RM/COBOL User's Guide, where it states, "The data is encapsulated in an eight-byte overhead to provide data transparency.."
If I may make an observation, your approach is very brittle - and the IRS will happily break your code next year with minor tweaks to the ACA specification. (I have been through ACA compliance...) A far better way to do this is using XML Extensions, and stop coding XML output in COBOL.
If you wish to continue the approach you have started, you will need to create a fixed length binary sequential file with a record length of 1 (one) character. Then, you will write each character with a WRITE statement. Binary, fixed record length files have no additional structure imposed by the RM file manager, since the fixed record length obviates the need for record lengths to be stored with the data.
But, do yourself a favor - use XML Extensions.
I am trying to create a sequential file that does not have carriage returns in it (for ACA XML reporting).
This is my Select Statement:
SELECT MANIFEST
ASSIGN TO RANDOM WS-MANIFEST-FILE
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS MANIFEST-STATUS.
This is my FD:
FD MANIFEST
LABEL RECORD IS STANDARD
RECORD IS VARYING IN SIZE FROM 1 TO 2000 CHARACTERS
DEPENDING ON WS-MANIFEST-CNT
VALUE OF LABEL IS WS-MANIFEST-FILE.
01 MANIFEST-REC.
05 MANIFEST-LINE PIC X(2000).
This is my routine to write to the file:
WRITE-MANIFEST-XML.
MOVE ZEROES TO WS-MANIFEST-CNT.
PERFORM VARYING WS-MANIFEST-CNT FROM 2000 BY -1
UNTIL MANIFEST-LINE(WS-MANIFEST-CNT:1) NOT = SPACES
CONTINUE
END-PERFORM.
WRITE MANIFEST-REC.
This is my output. The program is throwing random stuff in front of each record. I've debugged my program, and this stuff isn't being added in the program. Does anyone know how I can get rid of it? Or where it is coming from in the first place?

Unfortunately, using XML Extensions is not an option for me, my company doesn't want to purchase it.
So I have manually create my XML files.
Is the way you suggested the only way I can write a file with no carriage returns? That is all I'm trying to do.
I am trying to create a sequential file that does not have carriage returns in it (for ACA XML reporting).
This is my Select Statement:
SELECT MANIFEST
ASSIGN TO RANDOM WS-MANIFEST-FILE
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS MANIFEST-STATUS.
This is my FD:
FD MANIFEST
LABEL RECORD IS STANDARD
RECORD IS VARYING IN SIZE FROM 1 TO 2000 CHARACTERS
DEPENDING ON WS-MANIFEST-CNT
VALUE OF LABEL IS WS-MANIFEST-FILE.
01 MANIFEST-REC.
05 MANIFEST-LINE PIC X(2000).
This is my routine to write to the file:
WRITE-MANIFEST-XML.
MOVE ZEROES TO WS-MANIFEST-CNT.
PERFORM VARYING WS-MANIFEST-CNT FROM 2000 BY -1
UNTIL MANIFEST-LINE(WS-MANIFEST-CNT:1) NOT = SPACES
CONTINUE
END-PERFORM.
WRITE MANIFEST-REC.
This is my output. The program is throwing random stuff in front of each record. I've debugged my program, and this stuff isn't being added in the program. Does anyone know how I can get rid of it? Or where it is coming from in the first place?

Short answer: yes, the only way.
Apologies for the following lecture - but perhaps you can formulate an argument to take up to management that will make you more productive...
<lecture>
XML Extensions is fairly economical, since it is only a developer license. The XML support already is in the runtime at no extra cost.
And, XML is a two-way street most of the time. Take ACA compliance, for example. The IRS check for errors produces an XML document. Does your management expect you to write an XML parser to process this document? If you do attempt this, you will have soon expended enough time to have paid for XML Extensions along with a decent XML/XSLT editor such as Stylus Studio. And, you will have a vastly inferior and brittle solution. I have seen more than one XML parser implemented in COBOL, and none of them can handle real XML in all of its varieties.
Finally, XML is THE language of data transmission over the web, and appears to remain so for many years. What is the opportunity cost for your company if each XML opportunity/challenge is met with avoidance or long development time? If you amortize the license cost over a few years, even including maintenance, your company probably spends more money per month on coffee.
</lecture>
PS Another favorite language for data transmission is JSON (JavaScript Object Notation). XML Extensions can rather easily produce JSON (it can be seen in the Micro Focus tutorial for Xcentrisity Business Information Server), and I have published a method for XML Extensions to parse and import JSON as well. So, two for the price of one!
#ConvertJSONtoXML#XML#XMLExtensions
I am trying to create a sequential file that does not have carriage returns in it (for ACA XML reporting).
This is my Select Statement:
SELECT MANIFEST
ASSIGN TO RANDOM WS-MANIFEST-FILE
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS MANIFEST-STATUS.
This is my FD:
FD MANIFEST
LABEL RECORD IS STANDARD
RECORD IS VARYING IN SIZE FROM 1 TO 2000 CHARACTERS
DEPENDING ON WS-MANIFEST-CNT
VALUE OF LABEL IS WS-MANIFEST-FILE.
01 MANIFEST-REC.
05 MANIFEST-LINE PIC X(2000).
This is my routine to write to the file:
WRITE-MANIFEST-XML.
MOVE ZEROES TO WS-MANIFEST-CNT.
PERFORM VARYING WS-MANIFEST-CNT FROM 2000 BY -1
UNTIL MANIFEST-LINE(WS-MANIFEST-CNT:1) NOT = SPACES
CONTINUE
END-PERFORM.
WRITE MANIFEST-REC.
This is my output. The program is throwing random stuff in front of each record. I've debugged my program, and this stuff isn't being added in the program. Does anyone know how I can get rid of it? Or where it is coming from in the first place?

Hmmm. Well, there are several other answers, but none of them that great.
First, you could use fixed length sequential records. I believe that those will have no overhead in them. However, you'd either have a lot of spaces at the end of each record, or you could collect the XML elements into a large record and write them when the record won't hold the next one. The downside is that you'll have a big area of spaces at the end of the file.
Second, you could create some COBOL callable subprograms that will open the file using the C runtime library and then write records into the document they way that you want them to be written.
Third, you could write the XML document as a line sequential file, and when you are finished, perform a CALL SYSTEM to invoke sed to filter the carriage returns out of the output file.
I am trying to create a sequential file that does not have carriage returns in it (for ACA XML reporting).
This is my Select Statement:
SELECT MANIFEST
ASSIGN TO RANDOM WS-MANIFEST-FILE
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS MANIFEST-STATUS.
This is my FD:
FD MANIFEST
LABEL RECORD IS STANDARD
RECORD IS VARYING IN SIZE FROM 1 TO 2000 CHARACTERS
DEPENDING ON WS-MANIFEST-CNT
VALUE OF LABEL IS WS-MANIFEST-FILE.
01 MANIFEST-REC.
05 MANIFEST-LINE PIC X(2000).
This is my routine to write to the file:
WRITE-MANIFEST-XML.
MOVE ZEROES TO WS-MANIFEST-CNT.
PERFORM VARYING WS-MANIFEST-CNT FROM 2000 BY -1
UNTIL MANIFEST-LINE(WS-MANIFEST-CNT:1) NOT = SPACES
CONTINUE
END-PERFORM.
WRITE MANIFEST-REC.
This is my output. The program is throwing random stuff in front of each record. I've debugged my program, and this stuff isn't being added in the program. Does anyone know how I can get rid of it? Or where it is coming from in the first place?

Another option is to write the XML using line sequential file (as Mike suggests), then use a CALL SYSTEM to invoke an XSLT processor to produce the file. Since I know Amy has asked many COBOL WOW questions, and because a C# solution to the MD5 requirement was helpful, I will presume that the server is a Windows Server.
So, the steps can be:
- use COBOL writing normal line sequential records to output a simplified XML structure
- CALL SYSTEM to invoke a Powershell command line to apply an XSLT to the simplified XML creating the IRS required XML (which is not tolerant of a lot of extraneous whtespace) as output. An example of a Powershell command line implementation can be found at here.
- An alternative to Powershell would be either VBScript or JScript. You can find a JScript script to invoke XSLT in the last two postings in this thread. A VBScript implementation would be very similar to JScript.
- The required XSLT is fairly simple (depending on how close the COBOL produced XML is to the IRS requirement). Absent a decent XML/XSLT editor, you can use a text editor to create the XSLT. You can even use the XML plug-in on Notepad (a free Windows text editor) to test the XSLT transform.
Amy, I noticed by your data-names that you are working on the manifest document. Have you already done the data file? If so, how?