Page 1 of 1
How to add data in last position or any specific position in sequential dataset thru rexx?
Posted: Mon Oct 29, 2018 8:02 pm
by alpna
How to add data in last position or any specific position in sequential dataset thru rexx?
Or is there any syntax thru which I can give exactly number of spaces while writing in sequential dataset.
[ Post made via Android ] 
Re: How to add data in last position or any specific position in sequential dataset thru rexx?
Posted: Mon Oct 29, 2018 9:50 pm
by enrico-sorichetti
the exact syntax depends on how You are building the record, and the alignment.
here are two alternatives
the last field is left aligned
Code: Select all
a_sequence_of_fields_padded_with_blanks.....................morechars...........
lrecl=80
lhead=60
part1="a_sequence_of_fields_padded_with_blanks"
part2="morechars"
xx= left( left( part1, lhead ) || part2, lrecl)
the last field is right aligned
Code: Select all
another_sequence_of_fields_padded_with_blanks..........................morechars
lrecl=80
part1="another_sequence_of_fields_padded_with_blanks"
part2="morechars"
xx= part1 || right( part2, lrecl-length(part1) )
the tested snippet
Code: Select all
#! /usr/bin/env rexx
lrecl=80
lhead=60
part1="a_sequence_of_fields_padded_with_blanks"
part2="morechars"
xx= left( left( part1, lhead ) || part2, lrecl)
say ">>>"length(xx)
say ">>>"xx"<<<"
lrecl=80
part1="another_sequence_of_fields_padded_with_blanks"
part2="morechars"
xx= part1 || right( part2, lrecl-length(part1) )
say ">>>"length(xx)
say ">>>"xx"<<<"
the output
Code: Select all
>>>80
>>>a_sequence_of_fields_padded_with_blanks morechars <<<
>>>80
>>>another_sequence_of_fields_padded_with_blanks morechars<<<
Re: How to add data in last position or any specific position in sequential dataset thru rexx?
Posted: Mon Nov 05, 2018 3:52 pm
by alpna
Thank you so much Enrico. I am going through them. Great help.