Q: I'm trying to split a packed field containing a date in MDY format into separate fields so I can create an access path that will sort the records in YMD format. I have tried the SST keyword, but it will only substring on zoned, character, or hexadecimal data types. I need some advice on how to get around this problem.
? John Grzybowski
A: If you're stuck with a packed field containing dates in MDY format, there is a way to create a logical access path by date over the file. The trick is to first override the field definition to zoned. You can do this by placing an S in position 35 on the packed field in the DDS for the logical file. You can then use the SST keyword to break down the field into its separate components by creating three new character fields. These new fields become the key fields for the logical file. You can see this technique illustrated in Figures 3 and 4.
? James Sedwick
TechTalk: Creating an Access Path over a Packed MDY Field
Figure 3: Physical File Definition
A R DATEREC A FLD1 3 0 TEXT('FIELD 1') A FLD2 3 0 TEXT('FIELD 2') A MDY 6 0 TEXT('DATE FIELD') A K FLD1
TechTalk: Creating an Access Path over a Packed MDY Field
Figure 4: Logical File Definition by YMD
A R DATEFMT PFILE(DATEPF) A FLD1 R A FLD2 R A MDY R S A YEAR I SST(MDY 5 2) A MONTH I SST(MDY 1 2) A DAY I SST(MDY 3 2) A K YEAR A K MONTH A K DAY
Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:
LATEST COMMENTS
MC Press Online