Quantcast
Channel: CPYTOIMPF – IT Answers
Viewing all articles
Browse latest Browse all 39

Trimming og spaces in CLLE

$
0
0

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.


Viewing all articles
Browse latest Browse all 39

Trending Articles