Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset counter properly + don't forget the current char #198

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/services/ServiceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,26 @@ export function parseUnixScriptByNumOfChars(script: string, charCount: number =
if (lastSpaceIndex !== -1) {
// If there's a space within the character limit, backtrack to the last encountered space
const backtrackedPart = currentPart.substring(0, lastSpaceIndex);
parts.push(backtrackedPart);
currentPart = currentPart.substring(lastSpaceIndex + 1);
}
if (currentPart.length > 0) {
// Add the current part and reset the counter
parts.push('\n');
counter = 0;
parts.push(backtrackedPart + '\n');
currentPart = currentPart.substring(lastSpaceIndex + 1) + script[i]; // Include the current character
} else {
// If no space found, push the currentPart as is
parts.push(currentPart + '\n');
currentPart = script[i]; // Don't forget the current char we are on
}
counter = currentPart.length;
} else {
currentPart += script[i];
counter++;
}
currentPart += script[i];
counter++;
}
if (currentPart.length > 0) {
parts.push(currentPart);
}
return parts.join('');
}


export function startBPXBATCHAndShellSession(jobName: string = JCL_JOBNAME_DEFAULT): string {
return `//${jobName} EXEC PGM=BPXBATCH,REGION=0M
//STDOUT DD SYSOUT=*
Expand Down
Loading