Packed field substring
3 posters
Page 1 of 1
Packed field substring
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
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
packed filed substring
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.
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
Re: Packed field substring
Thanks. I tried as mentioned but I get a compile time error.
Raj
Raj
rajkumar400- Posts : 59
Join date : 2010-12-25
Re: Packed field substring
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
*******************************
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
Re: Packed field substring
Thanks. But without define the filed as a Zoned field, is there any way to do?
raj
raj
rajkumar400- Posts : 59
Join date : 2010-12-25
Similar topics
» What is a field type? List the 3 field types
» File Zoned Decimal has been changed to Packed Decimal in RPG
» What is Function field?
» How to Bold the field value in RPG?
» What is a Virtual field?
» File Zoned Decimal has been changed to Packed Decimal in RPG
» What is Function field?
» How to Bold the field value in RPG?
» What is a Virtual field?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum