PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Join the forum, it's quick and easy

PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).
PMS Information Systems
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Packed field substring

3 posters

Go down

Packed field substring Empty Packed field substring

Post  rajkumar400 Sat Dec 25, 2010 1:49 pm

I have a PF with a field defined FLD1 as 8P 0, I want to create a logical on this file by substring the FLD1 into the following 3 fields.

1 - 4 position as filed name in LF YYYY
5 - 6 position as MM
7 - 8 position as DD

How this can be achived using LF?

Thanks in Advance!

Raj

rajkumar400

Posts : 59
Join date : 2010-12-25

Back to top Go down

Packed field substring Empty packed filed substring

Post  kushaalrathi Sun Dec 26, 2010 7:21 pm

A R REC1 PFILE(PF1)
A
A YYYY I SST(DATE 1 4)
A MM I SST(DATE 5 2)
A DD I SST(DATE 7 2)
A
Note: The starting position of the substring is specified according to its position in the field being operated on (Date), not according to its position in the file. The I in the Usage column indicates input-only.

Substring fields can also be used as key fields and select/omit fields.

kushaalrathi

Posts : 12
Join date : 2010-12-26

Back to top Go down

Packed field substring Empty Re: Packed field substring

Post  rajkumar400 Wed Dec 29, 2010 1:59 am

Thanks. I tried as mentioned but I get a compile time error.

Raj

rajkumar400

Posts : 59
Join date : 2010-12-25

Back to top Go down

Packed field substring Empty Re: Packed field substring

Post  soundhar Wed Dec 29, 2010 2:58 pm

Hi, Declare FLD1 as zoned and not as Packed.It will works sure,because Zoned-a digit is represented by a byte and Packed-a digit is represented by a half byte...So use Zoned type...Thats the problem
SST:
A R RECFMT
A EMPCDE 5S 0
A EMPNAM 25A
A FLD1 8S 0
A K EMPCDE
****************************************************
SST1:
A R RECFMT PFILE(PMS90/SST)
A EMPCDE
A EMPNAM
A YYYY I SST(FLD1 1 4)
A MM I SST(FLD1 5 2)
A DD I SST(FLD1 7 2)
A K EMPCDE
****************************************************
SST:-RECORDS r
EMPCDE EMPNAM FLD1
1,000 SOUNDHAR.G 19850505
*******************************
SST1:-RECORDS r
EMPCDE EMPNAM YYYY MM DD
1,000 SOUNDHAR.G 1985 05 05
*******************************

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

Back to top Go down

Packed field substring Empty Re: Packed field substring

Post  rajkumar400 Wed Dec 29, 2010 10:37 pm

Thanks. But without define the filed as a Zoned field, is there any way to do?

raj

rajkumar400

Posts : 59
Join date : 2010-12-25

Back to top Go down

Packed field substring Empty Re: Packed field substring

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum