Function SET015A: Export/Import an Export list

LANSA

Function SET015A: Export/Import an Export list

********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_015);
********** COMMENT(Function .......: SET015A);
********** COMMENT(Created on .....: 13/03/00 at 12:12:37);
********** COMMENT(Description ....: Export/Import an export list);
********** COMMENT(Version.........: 1);
********** COMMENT();
********** COMMENT(Full Description: The purpose of this function is to);
********** COMMENT(export and import an export list.);
********** COMMENT();
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as);
********** COMMENT(sample material only. No warranty concerning the);
********** COMMENT(material or its use in any way whatsoever is);
********** COMMENT(expressed or implied.);
********** COMMENT();
********** COMMENT(Minimum LANSA release: 8.0);
********** COMMENT();
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT);
********** COMMENT();
********** COMMENT(Group and field definitions);
********** COMMENT();
DEFINE FIELD(#S_015PFX) TYPE(*CHAR) LENGTH(003) DESC('Job name prefix');
********** COMMENT(Mainline);
********** COMMENT();
DEF_COND NAME(*AS400) COND('*CPUTYPE = AS400');
IF COND(*AS400);
ELSE;
MESSAGE MSGTXT('Not available on PC');
MENU;
ENDIF;
********** COMMENT();
GROUP_BY NAME(#S_GRP) FIELDS((#S_LBPRTDT *HIDDEN)(#S_LBSYSPG *HIDDEN)(#S_EXPLIST)(#S_SAVFNAM *HIDDEN)(#S_PRTPF1)(#S_PRTPT1)(#S_PRTPT2));
BEGIN_LOOP;
********** COMMENT(Note that the partition fields #S_PRTPF1 #S_PRTPT1);
********** COMMENT(and #S_PRTPT2 have been used instead of the file);
********** COMMENT(fields #S_PARTFRM #S_PARTTO1 and #S_PARTTO2.);
********** COMMENT(This allows the prompt program to differ from the);
********** COMMENT(standard prompt on a partition field.);
********** COMMENT();
********** COMMENT(Note also that by not specifying the prompt on the);
********** COMMENT(fields #S_PRTPF1 #S_PRTPT1 #S_PRTPT2 , and by referring);
********** COMMENT(these fields to a common reference field #S_PRTPATH);
********** COMMENT(which does have a prompt program, the need to create);
********** COMMENT(multiple prompt programs is avoided.);
********** COMMENT();
REQUEST FIELDS(#S_GRP);
********** COMMENT();
********** COMMENT(validate);
********** COMMENT();
BEGINCHECK;
********** COMMENT();
VALUECHECK FIELD(#S_EXPLIST) WITH_LIST(' ') IN_LIST(*ERROR) NOT_INLIST(*NEXT) MSGTXT('Export list must not be blank');
********** COMMENT(Check the individual partition values);
IF COND('#S_PRTPF1 *NE *BLANKS');
FILECHECK FIELD(#S_PRTPF1) USING_FILE(SETPRT) MSGTXT('Invalid partition - Use prompt to select');
ENDIF;
IF COND('#S_PRTPT1 *NE *BLANKS');
FILECHECK FIELD(#S_PRTPT1) USING_FILE(SETPRT) MSGTXT('Invalid partition - Use prompt to select');
ENDIF;
IF COND('#S_PRTPT2 *NE *BLANKS');
FILECHECK FIELD(#S_PRTPT2) USING_FILE(SETPRT) MSGTXT('Invalid partition - Use prompt to select');
ENDIF;
********** COMMENT(Validating as follows, rather than using a filecheck,);
********** COMMENT(allows multiple fields to be highlighted if there is);
********** COMMENT(an error.);
CHECK_FOR IN_FILE(SETEXP) WITH_KEY(#S_PRTPF1 #S_PRTPT1 #S_PRTPT2);
IF_STATUS IS_NOT(*EQUALKEY);
SET_ERROR FOR_FIELD(#S_PRTPF1 #S_PRTPT1 #S_PRTPT2) MSGTXT('Invalid combination of partitions - use prompt to select');
ENDIF;
ENDCHECK;
********** COMMENT(Generate the job name);
IF_NULL FIELD(#S_PRTPF1);
CHANGE FIELD(#S_015PFX) TO(I_);
ELSE;
IF_NULL FIELD(#S_PRTPT1 #S_PRTPT2);
CHANGE FIELD(#S_015PFX) TO(E_);
ELSE;
CHANGE FIELD(#S_015PFX) TO(EI_);
ENDIF;
ENDIF;
USE BUILTIN(TCONCAT) WITH_ARGS(#S_015PFX #S_EXPLIST) TO_GET(#JOBNAME);
********** COMMENT(Generate the save file name);
USE BUILTIN(TCONCAT) WITH_ARGS(S15 #S_EXPLIST) TO_GET(#S_SAVFNAM);
********** COMMENT();
********** COMMENT(Note that the libl, jobq, outq and msgq are all);
********** COMMENT(from the users job description.);
********** COMMENT();
********** COMMENT(Library List: The CL program SET015EXIM adds);
********** COMMENT(the current internal LANSA program library and);
********** COMMENT(the export partition data library at run time.);
********** COMMENT();
********** COMMENT(When the CL program invokes LANSA request(EXPORT));
********** COMMENT(or LANSA request(IMPORT) the library list will be);
********** COMMENT(modified again:);
********** COMMENT(1. The LANSA internal data library will be added);
********** COMMENT(2. The import or export partition program library will);
********** COMMENT( be added.);
********** COMMENT(3. On import, the import partition data library may be);
********** COMMENT( added);
********** COMMENT();
SUBMIT PGM(SET015EXIM) PARM(#S_LBPRTDT #S_LBSYSPG #S_EXPLIST #S_SAVFNAM #S_PRTPF1 #S_PRTPT1 #S_PRTPT2) JOB(#JOBNAME) JOBD(*USRPRF);
MESSAGE MSGTXT('Export/Import submitted to batch');
********** COMMENT();
END_LOOP;