Last active
October 20, 2021 15:23
-
-
Save kadler/2907a5e4eb9068118ffe9fb2eeede680 to your computer and use it in GitHub Desktop.
Convert SRCPF member to stream file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/QOpenSys/pkgs/bin/bash | |
MBRPATH=/qsys.lib/qsysinc.lib/h.file/stdio.mbr | |
RCDLEN=80 # default, use whatever was specified on CRTSRCPF | |
CCSID=037 # needs leading zeros if less than 3 digits | |
OUTFILE=stdio.h | |
# What it does: | |
# 1. Convert the member "stream of bytes" to UTF-8 | |
# 2. Split the byte stream in to RCDLEN sized lines | |
# 3. Strip any trailing whitespace from each line | |
/QOpenSys/usr/bin/iconv -f IBM-$CCSID -t UTF-8 "$MBRPATH" | | |
fold -b -w $RCDLEN | | |
sed 's| *$||g' > "$OUTFILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment