I've got the following (MVS) input file record (partial record) and HEX ON
??-
A56
A20
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
1357
2468
or if the input was ABC123 then it would output it as
?A
AC2
B13
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:
FieldA x(04)
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):
AC2
B13
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
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Yianis,
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:
Code:
OPTION COPY
OUTREC FIELDS=(1,n,HEX)
where n is the number of bytes you want to convert from binary to hex.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You don't need 76C' ' in HEADER1 or 472C' ' in TRAILER1. DFSORT will pad out the header and trailer with blanks automatically.
Quote:
INCLUDE COND=(01,02,BI,EQ,X'04')
will actually look for X'0400' in 1-2 - is that what you want.
Quote:
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.
Quote:
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.
I have another question... I first tried ti check out on this forum to see if it's there or even some pdf manuals, but I'm a bit tired looking and I will ask you...
I need to update the above to do the following:
There are some header records in my input file and 1 of them have a date field that I need to use to populate the date field in my output.
The current logic :
Code:
OUTREC FIELDS=(C'IRO',
C' ',
DATE1,
etc...
I use the DATE1 to output the system date, but I need to read it in from my input file on a header record..
Now I need to read the first record and take the date field 06/05/06 and use that date to populate in place of the DATE1 I had above and in the YYYYMMDD format.
Also,
I need to replace all 'A' with ' ' (blanks) in the input fields defined in the outrec 20,4,HEX & 24,7,HEX
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.
To learn more about all the things you can do with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from: