Reusable Part VL_SAM083: Operating System File Handler

LANSA

Reusable Part VL_SAM083: Operating System File Handler
Name: VL_SAM083

Description: The following RDMLX reusable component is used by various forms to perform operations on operating system files.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM DISPLAYPOSITION(1) TABPOSITION(1);
;
MthRoutine MakeTempFileName;
Define_Map *input #Std_Obj #iSuffix ;
Define_Map *input #Std_Obj #iNamePart1 ;
Define_Map *input #Std_Obj #iNamePart2 mandatory(' ');
Define_Map *input #Std_Obj #iNamePart3 mandatory(' ');
Define_Map *input #Std_Obj #iNamePart4 mandatory(' ');
Define_Map *input #Std_Obj #iNamePart5 mandatory(' ');
Define_Map *output #SysVar$Av #oFileName ;
Use tconcat (*temp_dir #iNamePart1.value) (#SysVar$Av);
if '#iNamePart2.Value *ne *blanks';
Use tconcat (#SysVar$Av '_' #iNamePart2.value ) (#SysVar$Av);
Endif ;
if '#iNamePart3.Value *ne *blanks';
Use tconcat (#SysVar$Av '_' #iNamePart3.value ) (#SysVar$Av);
Endif ;
if '#iNamePart4.Value *ne *blanks';
Use tconcat (#SysVar$Av '_' #iNamePart4.value ) (#SysVar$Av);
Endif ;
if '#iNamePart5.Value *ne *blanks';
Use tconcat (#SysVar$Av '_' #iNamePart5.value ) (#SysVar$Av);
Endif ;
Use tconcat (#SysVar$Av '.' #iSuffix.Value) (#SysVar$Av);
Set #oFileName Value(#SysVar$Av) ;
EndRoutine ;
;
MthRoutine ExecuteFile ;
Define_Map *input #SysVar$Av #iFileName;
Define_Map *output #Std_Num #oRetCode mandatory(0);
Define #OSRetc RefFld(#Std_Num);
Use System_Command (H #iFileName.Value) (#OSRetc);
if '#OSRetc *ne 0';
Message 'Requested file start operation failed' ;
endif ;
Set #ORetCode Value(#OSRetc) ;
EndRoutine ;
;
END_COM ;