145 pts.
 Trimming og spaces in CLLE
Hi, i am using v5r4, CLLe I have creted this pgm to transfer stream file into ifs folder        PGM        Dcl Var(&Data) Type(*Char) Len(50)                    DCL VAR(&Folder) TYPE(*CHAR) LEN(30)             DCL VAR(&Filename) TYPE(*CHAR) LEN(100) /* Accessing the folder name from database to store the stream file INtest.CSV     */        CALL       PGM(MYS222B) PARM(' ' 'KEYF' &DATA ' ')        CHGVAR     VAR(&folder) VALUE(%SST(&DATA 1 30))        /* Create the name of stream file INtest.CSV     */                                                                          CHGVAR     VAR(&FILENAME) VALUE('/' *cat &Folder +                          *cat  'IN' *CAT +                                            'test.csv')                                                                                                                                      /* Copy the data                                           */                                                                                     CPYTOIMPF  FROMFILE(MyPF) TOSTMF(&FILENAME) +                                MBROPT(*add) STMFCODPAG(*PCASCII) +                                RCDDLM(*CRLF) FLDDLM(',') DATFMT(*EUR) +                           TIMFMT(*EUR)                                                                                                             EndPgm                  Value of &folder    = 'Myfolder/                                 ' Value of &Filename = '/Myfolder/                                  INtest.csv' the problem is that file name is taking extra spaces because length of variable &folder is 30 the data is only in 10 charecter. i can not fix the length of folder name because it can be changed.     i need the Value of &Filename = '/Myfolder/INtest.csv'                                is there any way to this (by trimming or anything else.. Thanks.

Software/Hardware used:
AS400
ASKED: March 29, 2011  8:47 AM
UPDATED: March 30, 2011  1:01 PM

Answer Wiki:
Try this CHGVAR VAR(&FILENAME) VALUE('/' *Tcat &Folder *Tcat 'IN' *TCAT 'test.csv')
Last Wiki Answer Submitted:  March 29, 2011  3:32 pm  by  CharlieBrowne   32,945 pts.
All Answer Wiki Contributors:  CharlieBrowne   32,945 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

thanks !

it works..!

 145 pts.

 

Your welcome
That is why we are here

 32,945 pts.