I've got the following (MVS) input file record (partial record) and HEX ON
The above field in the record is not defined as HEX or BInary or anything, but take it for granted that this is the field and I want to read in and I would like to output it in Character.
In other words, can I read the 1st byte in and output it as character AA ?
Not sure how you would define it as an input since it looks like a Hex value x'AA'. The file that comes in to me has not standard format when outputing the values. Example: The input may be numeric (i.e. 12345678) and this process will output it as follow:
?? <-- hex value with HEX ON
or if the input was ABC123 then it would output it as
So I would like to read them in and output them as follow:
The problem is that the input file (field itslef) is no defined as binary or Hex but just Character (i.e. in cobol the input layout is defined as Character) example:
But I read the field 1 byte at a time (i.e. X(01) ) and then look at the 2 bytes (i.e. AA) and then write them out as AA to my output file.
The reason for this is because the file that I am reading in has been created thru a weird system where it outputs the fields (character and numeric) in an unknown format...
Example: Input field is a Serial number ABC123 and any normal person :-) would output it as a x(6) character and off you go. In my case the field is inserted to a file in the following format (unknown and not HEX or BINARY):
So I want to read this in and output it as ABC123...
I know how to read in a PD or BI format, that is simple, but when it is a single byte you want to read 1 at a time and reformat it from
If I understand what you want correctly, you're presenting it as more complicated than it is. The input is binary. The output you want is hex. You can use the following DFSORT control statements to do this:
where n is the number of bytes you want to convert from binary to hex.
You don't need 76C' ' in HEADER1 or 472C' ' in TRAILER1. DFSORT will pad out the header and trailer with blanks automatically.
will actually look for X'0400' in 1-2 - is that what you want.
First, i need to create my output file as RECFM=FBA why ????
By default, DFSORT uses FBA and ANSI carriage control characters for reports so it can do page ejects, etc. If you want FB and no carriage control characters, just specify REMOVECC on your OUTFIL statement.
SUMMED AMOUNT ?????? from input 35,5,hex above
Also, how do I include the summed amount field above
Do you mean the 34,5,HEX field?
This DFSORT job will do what I think you're asking for:
I just want the '04' records from the file in the 1st byte. This file contains 3 different record formats and I only want the '04' detail records. I guess I just got lucky that the 1st 2 bytes happen to be x'0400', but waht I really want is just the x'04' in the first byte.
Also, in the HEADER1 section, I need the date & time format the same as in the OUTREC FIELDS sections (i.e. YYYYMMDD & HHMMSS. When I change the value from DATE to DATE1, it doesn' like it.
I searched for some documenation on the Date/Time formats and I found the DATENS=(4MD) will output it as YYYYMMDD and the TIMENS=(24) will output it as HHMMSS.
I just realized (duh!!!) that I had INCLUDE COND=(01,02,BI,EQ,X'04')...thinking that I was looking at 1 byte. I realized now what you meant earlier about looking at 2 bytes. My bad..changed it to INCLUDE COND=(01,01,BI,EQ,X'04')
Thanks again... You (Frank) are truly a good resource :-)
Wow, DFSORT has come along way .... I haven't used it for a while and it was basically more for simple extracts and the odd remove duplicates...but it's a lot more than that....Love It ... Will use it or at least try to use it for everything possible.
Oh, I did try it in a following step, that is, I created the file first using the code above, and then I used the output file as input to the following step and coded it as follows and it works, but I was just wondering if there is a better way:
All I did is created another step further to replace the 'A' with ' ' but still working on the Header date field. The 'A' replacing starts from position 25 thru 57 ( I mentioned above 2 fields but I had to add another field since then.