AS400 - File
480 pts.
0
Q:
AS400 - File
I wanted change a flat file as a keyed file.

What are all the ways there?

ASKED: Nov 12 2009  10:24 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
6350 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Create a definitoin for the file with DDS or create a table with SQL.
Then do a CPYF from the flat file to the defined file.
Use the FMTOPT(*NOCHK) on the CPYF command
Last Answered: Nov 12 2009  2:10 PM GMT by CharlieBrowne   6350 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

TomLiotta   7620 pts.  |   Nov 13 2009  5:41AM GMT

Please give some description of your “flat file”. Many of us think of them as “program-described” physical files with a single field. But some others would mean streamfiles in an IFS directory. What file do you have? Can you show examples of a couple rows?

Tom

 

Rajeshece   480 pts.  |   Nov 13 2009  1:04PM GMT

Flat is file with single field
like
A R RFMT
A FLD1

 

Philpl1jb   24510 pts.  |   Nov 14 2009  1:45AM GMT

ok then you’re on Charlie Browns solution
Describe a physical file with fields for the stuff in your flat file .. but all text since your flat file is all text. This file’s record should be at least the length of the flat file record and breaks out the fields you want to key on, key on those fields.
Compile the physical file
Then copy the flat file (CPFY) to the new file using the fmtopt *NOCHK.
Then you can use the new keyed file.
Phil

 

TomLiotta   7620 pts.  |   Nov 17 2009  9:34PM GMT

It only needs to use ‘text’ fields if the field positions contain text bytes. If positions contain packed values, then those positions need to be described as packed. If positions contain binary values, then the description should be binary.

The DDS for the new physical file needs to list definitions of the subfields of FLD1 according to how those positions actually exist. When the image-copy is done (i.e., *NOCHK) there won’t be any conversion. The new file should already have the appropriate definitions for whatever the data is.

Of course, that will most likely be text…

Tom

 
0