Skip to content

Commit

Permalink
fix: cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
janfh committed Jan 26, 2025
1 parent ec48ab9 commit dbd4bd5
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/api/IBMiContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,18 @@ export default class IBMiContent {
* @returns an array of ProgramExportImportInfo
*/
async getProgramExportImportInfo(object: IBMiObject): Promise<ProgramExportImportInfo[]> {
const statement = [
`select PROGRAM_LIBRARY, PROGRAM_NAME, OBJECT_TYPE, SYMBOL_NAME, SYMBOL_USAGE,`,
` ARGUMENT_OPTIMIZATION, DATA_ITEM_SIZE`,
`from qsys2.program_export_import_info`,
`where program_library = '${object.library}' and program_name = '${object.name}' `,
`and object_type = '${object.type}'`
].join("\n");
const results = await this.ibmi.runSQL(statement);
if (!['*PGM', '*SRVPGM'].includes(object.type)) {
return [];
}
const results = await this.ibmi.runSQL(
[
`select PROGRAM_LIBRARY, PROGRAM_NAME, OBJECT_TYPE, SYMBOL_NAME, SYMBOL_USAGE,`,
` ARGUMENT_OPTIMIZATION, DATA_ITEM_SIZE`,
`from qsys2.program_export_import_info`,
`where program_library = '${object.library}' and program_name = '${object.name}' `,
`and object_type = '${object.type}'`
].join("\n")
);
if (results.length) {
return results.map(result => ({
program_library: result.PROGRAM_LIBRARY,
Expand All @@ -666,17 +670,19 @@ export default class IBMiContent {
*/
async getModuleExports(object: IBMiObject): Promise<ModuleExport[]> {
const name: string = Tools.makeid().toUpperCase();
const results = await this.runStatements(...[
if (object.type != '*MODULE') {
return [];
}
const results = await this.runStatements(
`@DSPMOD MODULE(${object.library}/${object.name}) DETAIL(*EXPORT) OUTPUT(*OUTFILE) OUTFILE(QTEMP/${name})`,
[
`select EXLBNM as MODULE_LIBRARY, EXMONM as MODULE_NAME, EXMOAT as MODULE_ATTR, EXSYNM as SYMBOL_NAME,`,
` case EXSYTY when '0' then 'PROCEDURE' when '1' then 'DATA' end as SYMBOL_TYPE, EXOPPP as ARGUMENT_OPTIMIZATION`,
` from QTEMP.${name}`
].join("\n")
]);
let exports: ModuleExport[] = [];
);
if (results.length) {
exports = results.map(result => ({
return results.map(result => ({
module_library: result.MODULE_LIBRARY,
module_name: result.MODULE_NAME,
module_attr: result.MODULE_ATTR,
Expand All @@ -685,7 +691,7 @@ export default class IBMiContent {
argument_optimization: result.ARGUMENT_OPTIMIZATION
} as ModuleExport));
}
return exports;
return [];
}

/**
Expand Down

0 comments on commit dbd4bd5

Please sign in to comment.