Hi Peter
I would simply test the leading character for the numeric portion and
shuffle along.  The following example code will convert FILEnnn style file
names:
   PGM        PARM(&INPFILE &OUTFILE)                      
                                                           
   DCL        VAR(&INPFILE) TYPE(*CHAR) LEN(10)            
   DCL        VAR(&OUTFILE) TYPE(*CHAR) LEN(10)            
   DCL        VAR(&PREFIX) TYPE(*CHAR) LEN(4)              
   DCL        VAR(&SUFFIX) TYPE(*CHAR) LEN(3)              
                                                           
   CHGVAR     VAR(&PREFIX) VALUE(%SST(&INPFILE 1 4))       
                                                           
   CHGVAR     VAR(&SUFFIX) VALUE(%SST(&INPFILE 5 3))       
   IF         COND(%SST(&SUFFIX 1 1) *EQ '0') THEN(CHGVAR +
                VAR(&SUFFIX) VALUE(%SST(&SUFFIX 2 2)))     
   IF         COND(%SST(&SUFFIX 1 1) *EQ '0') THEN(CHGVAR +
                VAR(&SUFFIX) VALUE(%SST(&SUFFIX 2 2)))     
                                                           
   CHGVAR     VAR(&OUTFILE) VALUE(&PREFIX *TCAT &SUFFIX)   
                                                           
   ENDPGM                                                  
Hope it helps
Jonathan
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Peter Vidal
Sent: 13 August 2007 15:44
To: Midrange Systems Technical Discussion
Subject: Convert Character to Decimal in CL: Trimming leading zeros
"CHGVAR     VAR(&DECVAL) VALUE(&CHARVAL)"
Now that this is clear, I do not want to complicate this more but I have a 
similar issue with a little variant.  I have file names which suffix is a 
number from 1 to 350 and I need to trim the leading zeros and then do some 
additional processing.  For example:
BEFORE: &CHARVAL = 'FILE001   '
AFTER:  &CHARVAL = 'FILE1     '
Again, I need to do this for files 1  to 350.
Thanks
Peter Vidal 
MAPICS IT Technical Support Team / SR System Analyst
10540 Ridge Rd., Ste 203, New Port Richey, FL 34654-5111
http://www.pall.com
"Leadership is the transference of vision."Hal Reed
----------------------------------------------------------------------------
----
Attention:
This communication may contain information that is confidential,
privileged and/or exempt from disclosure under applicable law.  
If you are not the intended recipient, please notify the sender 
immediately and delete the original, all attachments, and all 
copies of this communication.
----------------------------------------------------------------------------
----
As an Amazon Associate we earn from qualifying purchases.