diff --git a/src/api/IBMiContent.ts b/src/api/IBMiContent.ts index c6561440e..4a74bd458 100644 --- a/src/api/IBMiContent.ts +++ b/src/api/IBMiContent.ts @@ -154,6 +154,9 @@ export default class IBMiContent { while (true) { let copyResult: CommandResult; if (this.ibmi.dangerousVariants && new RegExp(`[${this.ibmi.variantChars.local}]`).test(path)) { + library = this.ibmi.sysNameInAmerican(library); + sourceFile = this.ibmi.sysNameInAmerican(sourceFile); + member = this.ibmi.sysNameInAmerican(member); copyResult = { code: 0, stdout: '', stderr: '' }; try { await this.ibmi.runSQL([ @@ -167,7 +170,7 @@ export default class IBMiContent { } else { copyResult = await this.ibmi.runCommand({ - command: `QSYS/CPYTOSTMF FROMMBR('${path}') TOSTMF('${tempRmt}') STMFOPT(*REPLACE) STMFCCSID(1208) DBFCCSID(${this.config.sourceFileCCSID})`, + command: `QSYS/CPYTOSTMF FROMMBR('${this.ibmi.sysNameInAmerican(path)}') TOSTMF('${tempRmt}') STMFOPT(*REPLACE) STMFCCSID(1208) DBFCCSID(${this.config.sourceFileCCSID})`, noLibList: true }); } @@ -231,6 +234,10 @@ export default class IBMiContent { if (this.ibmi.dangerousVariants && new RegExp(`[${this.ibmi.variantChars.local}]`).test(path)) { copyResult = { code: 0, stdout: '', stderr: '' }; try { + library = this.ibmi.sysNameInAmerican(library); + sourceFile = this.ibmi.sysNameInAmerican(sourceFile); + member = this.ibmi.sysNameInAmerican(member); + await this.ibmi.runSQL([ `@QSYS/CPYF FROMFILE(${library}/${sourceFile}) FROMMBR(${member}) TOFILE(QTEMP/QTEMPSRC) TOMBR(TEMPMEMBER) MBROPT(*REPLACE) CRTFILE(*YES);`, `@QSYS/CPYFRMSTMF FROMSTMF('${tempRmt}') TOMBR('${Tools.qualifyPath("QTEMP", "QTEMPSRC", "TEMPMEMBER", undefined)}') MBROPT(*REPLACE) STMFCCSID(1208) DBFCCSID(${this.config.sourceFileCCSID})`, @@ -243,7 +250,7 @@ export default class IBMiContent { } else { copyResult = await this.ibmi.runCommand({ - command: `QSYS/CPYFRMSTMF FROMSTMF('${tempRmt}') TOMBR('${path}') MBROPT(*REPLACE) STMFCCSID(1208) DBFCCSID(${this.config.sourceFileCCSID})`, + command: `QSYS/CPYFRMSTMF FROMSTMF('${tempRmt}') TOMBR('${this.ibmi.sysNameInAmerican(path)}') MBROPT(*REPLACE) STMFCCSID(1208) DBFCCSID(${this.config.sourceFileCCSID})`, noLibList: true }); } diff --git a/src/testing/encoding.ts b/src/testing/encoding.ts index 5d5c7ac7b..f7c09139d 100644 --- a/src/testing/encoding.ts +++ b/src/testing/encoding.ts @@ -180,9 +180,9 @@ export const EncodingSuite: TestSuite = { const ccsidData = connection.getCcsids()!; const tempLib = config.tempLibrary; - const varChar = connection.variantChars.local[0]; + const varChar = connection.variantChars.local[1]; - const testFile = `${varChar}SOURCES`; + const testFile = `${varChar}SCOBBY`; const testMember = `${varChar}MEMBER`; const attemptDelete = await connection.runCommand({ command: `DLTF FILE(${tempLib}/${connection.sysNameInAmerican(testFile)})`, noLibList: true }); @@ -206,6 +206,9 @@ export const EncodingSuite: TestSuite = { assert.ok(members.some(m => m.name === testMember)); assert.ok(members.some(m => m.file === testFile)); + const files = await connection.content.getFileList(`/QSYS.LIB/${tempLib}.LIB/${connection.sysNameInAmerican(testFile)}.FILE`); + assert.ok(files.length); + await connection.content.uploadMemberContent(undefined, tempLib, testFile, testMember, [`**free`, `dsply 'Hello world';`, `return;`].join(`\n`)); const compileResult = await connection.runCommand({ command: `CRTBNDRPG PGM(${tempLib}/${testMember}) SRCFILE(${tempLib}/${testFile}) SRCMBR(${testMember})`, noLibList: true });