Skip to main content
Nelson Schroth
Participating Frequently
Jul 31, 2024 3:38 PM UTC

Truncating output from a DICT item

I have a complex I-Descriptor that should never output more than 2 characters.  Therefor, I have it set to "2L".

Due to some bad data, a few records have 5-6 characters for this value.

How can I direct the dictionary item to only out 2 chars?



------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

    9 replies

    Shawn Waldie
    Jul 31, 2024 3:49 PM UTC

    I have a complex I-Descriptor that should never output more than 2 characters.  Therefor, I have it set to "2L".

    Due to some bad data, a few records have 5-6 characters for this value.

    How can I direct the dictionary item to only out 2 chars?



    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------

    On Unidata, the following will return the first two characters of the result of S.GET.LAST.NAME:

    SUBR("S.GET.LAST.NAME", PER.ID);@1[1,2]



    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------

    Nelson Schroth
    Participating Frequently
    Jul 31, 2024 3:59 PM UTC

    On Unidata, the following will return the first two characters of the result of S.GET.LAST.NAME:

    SUBR("S.GET.LAST.NAME", PER.ID);@1[1,2]



    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------

    Thanks Shawn - I was hoping to solve within the I-descritpor, but SUBR is always a choice.



    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------
    Neil Morris
    Rocketeer
    Jul 31, 2024 4:08 PM UTC

    I have a complex I-Descriptor that should never output more than 2 characters.  Therefor, I have it set to "2L".

    Due to some bad data, a few records have 5-6 characters for this value.

    How can I direct the dictionary item to only out 2 chars?



    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------

    Depending on the nature of the I-descriptor expression, I was going to suggest the same as Shawn. It shouldn't matter if it is a SUBR expression or not. But just adding the [1,2] to the end of the final value should only display the first 2 characters of the result.



    ------------------------------
    Neil Morris
    Universe Advanced Technical Support
    Rocket Software
    ------------------------------
    Shawn Waldie
    Jul 31, 2024 4:51 PM UTC

    Thanks Shawn - I was hoping to solve within the I-descritpor, but SUBR is always a choice.



    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------

    I was only using the S.GET.LAST.NAME subroutine as an example.

    The important part is the "[1,2]" (as @Neil Morris mentioned).



    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------
    David Green
    Inspiring
    Aug 1, 2024 6:55 AM UTC

    On Unidata, the following will return the first two characters of the result of S.GET.LAST.NAME:

    SUBR("S.GET.LAST.NAME", PER.ID);@1[1,2]



    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------

    Best approach is to fix the data.  You can even use a before trigger to make sure the data is the correct format.

    You could just use masking in your format, "2L##".



    ------------------------------
    David Green
    Computer Programmer
    Rocket Forum Shared Account
    ------------------------------
    Nelson Schroth
    Participating Frequently
    Aug 1, 2024 3:45 PM UTC

    Best approach is to fix the data.  You can even use a before trigger to make sure the data is the correct format.

    You could just use masking in your format, "2L##".



    ------------------------------
    David Green
    Computer Programmer
    Rocket Forum Shared Account
    ------------------------------

    Thanks David!  that worked like a charm.

    One of my co-workers wondered about using this on a linger field, say 20...would you need to use 20l################### or is there a shorthand like MATCH uses for such things, like 20L20(A) (which by the way outputs only the "A" :-)



    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------
    David Green
    Inspiring
    Aug 1, 2024 4:11 PM UTC

    Thanks David!  that worked like a charm.

    One of my co-workers wondered about using this on a linger field, say 20...would you need to use 20l################### or is there a shorthand like MATCH uses for such things, like 20L20(A) (which by the way outputs only the "A" :-)



    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------

    Yes there is a shorthand version.

    20L#20 Would do 20 # signs.



    ------------------------------
    David Green
    Computer Programmer
    Rocket Forum Shared Account
    ------------------------------
    Nelson Schroth
    Participating Frequently
    May 16, 2025 9:04 AM UTC

    Depending on the nature of the I-descriptor expression, I was going to suggest the same as Shawn. It shouldn't matter if it is a SUBR expression or not. But just adding the [1,2] to the end of the final value should only display the first 2 characters of the result.



    ------------------------------
    Neil Morris
    Universe Advanced Technical Support
    Rocket Software
    ------------------------------

    We have noticed that the 20L#20 works fine for "D" type dict items, but not for "A" type.

    Is there an equivilent for that?

    Example:

    0001: A

    0002: 07

    0003: DESCRIPTION

    0004:

    0005:

    0006:

    0007:

    0008:

    0009: L

    0010: 31

    0011: 1



    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------
    Tyrel Marak
    Participating Frequently
    May 19, 2025 10:30 AM UTC

    We have noticed that the 20L#20 works fine for "D" type dict items, but not for "A" type.

    Is there an equivilent for that?

    Example:

    0001: A

    0002: 07

    0003: DESCRIPTION

    0004:

    0005:

    0006:

    0007:

    0008:

    0009: L

    0010: 31

    0011: 1



    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------

    Hi Nelson,

    In field 7 put T1,20
    In field 8 put C;1;####################

    There might be other ways, but that's the first that comes to mind.



    ------------------------------
    Tyrel Marak
    Technical Support Manager
    Aptron Corporation
    Florham Park NJ US
    ------------------------------