How to add data in last position or any specific position in sequential dataset thru rexx?

Time Sharing Option, Interactive System Productivity Facility and REstructured eXtended eXecutor

Moderator: mickeydusaor

Post Reply
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

How to add data in last position or any specific position in sequential dataset thru rexx?

Post 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 ] Image
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: How to add data in last position or any specific position in sequential dataset thru rexx?

Post 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<<<
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
alpna
Registered Member
Posts: 56
Joined: Fri Jun 21, 2013 10:35 pm

Re: How to add data in last position or any specific position in sequential dataset thru rexx?

Post by alpna »

Thank you so much Enrico. I am going through them. Great help.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “TSO, ISPF & REXX (Do you still do CLIST?!).”