Create dynamic WS-Header using REXX



IBM's Command List programming language & Restructured Extended Executor

Create dynamic WS-Header using REXX

Postby arpitpatel01 » Mon Apr 06, 2015 7:50 pm

Hi,
I have this requirement to create a tool using REXX wherein user will provide Header Variables and then REXX will calculate its length and provide to output.

Input:
Name
Contact
AddressLine1
AddressLine2


Output should be
01 WS-HEADER.
     05 WS-HDR1  PIC X(04) VALUE 'Name'.
     05 WS-HDR2  PIC X(07) VALUE 'Contact'.
     05 WS-HDR3  PIC X(12) VALUE 'AddressLine1'.
     05 WS-HDR4  PIC X(12) VALUE 'AddressLine2'.


where, WS-HEADER AND WS-HDR* variables will be constant.

I am new to REXX. Kindly assist.

Thank you in advance!

Code'd
arpitpatel01
 
Posts: 15
Joined: Wed Mar 25, 2015 9:32 am
Has thanked: 0 time
Been thanked: 0 time

Re: Create dynamic WS-Header using REXX

Postby BillyBoyo » Mon Apr 06, 2015 7:58 pm

I think you'll have to provide a number of worked examples, and explain why this is needed.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Create dynamic WS-Header using REXX

Postby enrico-sorichetti » Mon Apr 06, 2015 8:24 pm

does not seem overly complicated to me

const.1 = "Name"
const.2 = "Contact"
const.3 = "AddressLine1"
const.4 = "AddressLine2"
const.0 = 4

say "01 WS-HEADER."
do    i = 1 to const.0
   l = right(length(const.i),2,"0")
   say "  05 WS-HDR"i" PIC X("l") VALUE '"const.i"'."
end


to obtain
01 WS-HEADER.
  05 WS-HDR1 PIC X(04) VALUE 'Name'.
  05 WS-HDR2 PIC X(07) VALUE 'Contact'.
  05 WS-HDR3 PIC X(12) VALUE 'AddressLine1'.
  05 WS-HDR4 PIC X(12) VALUE 'AddressLine2'.
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
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Create dynamic WS-Header using REXX

Postby BillyBoyo » Mon Apr 06, 2015 9:16 pm

But what is going to be done with that, and how will it be used?

It gets a piece of data like this, for the example:

NameContactAddressLine1AddressLine2


For a different user, different output:

enricoencico@gmail.conBase Camp 1High Mountain


Without knowing the data-layout for each case, how will the data be used? If it is just some static data to mark the owner of a program, it can just be done as comments. If it is to be used, how will it be used without tortuous code?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Create dynamic WS-Header using REXX

Postby enrico-sorichetti » Mon Apr 06, 2015 9:19 pm

my understanding is that the TS has some constants to be spread into some cobol declares
so no reason to investigate further :mrgreen:
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
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Create dynamic WS-Header using REXX

Postby BillyBoyo » Mon Apr 06, 2015 11:04 pm

Looks to me like an ill-thought waste of time, but at least they got some nice code from it :-)

There can only be one of these per program (the names cannot be made unique, so the data can't be referenced), so must be for different programs. Since they can't be used programatically in a sensible way as they stand, there seems little point. If they are just to assign personnel, better as generated comments.

Anyway, they've put such effort into it, I suspect the Tool will make it, whatever it is supposed to do.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Create dynamic WS-Header using REXX

Postby enrico-sorichetti » Tue Apr 07, 2015 1:30 am

what I find odd is the need to ask on a forum how to solve such a simple problem!
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
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Create dynamic WS-Header using REXX

Postby Pedro » Tue Apr 07, 2015 4:40 am

re: the need to ask

FYI: from the page title: "IBM MAINFRAME FORUM, A Help & Support Forum for Mainframe Beginners and Students"

As a beginner, the OP probably does not understand the problem well enough to ask the right question.

My guess is he wants to use the field names as the labels and to use a max length of the field:
01 WS-HEADER.
05 WS-name         PIC X(30).
05 WS-contact      PIC X(30).
05 WS-addressline1 PIC X(25).
05 WS-addressline1 PIC X(25).
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Create dynamic WS-Header using REXX

Postby enrico-sorichetti » Tue Apr 07, 2015 1:03 pm

My guess is he wants to use the field names

I beg to disagree ;)

the output sample posted seemed clear enough

Output should be
01 WS-HEADER.
05 WS-HDR1 PIC X(04) VALUE 'Name'.
05 WS-HDR2 PIC X(07) VALUE 'Contact'.
05 WS-HDR3 PIC X(12) VALUE 'AddressLine1'.
05 WS-HDR4 PIC X(12) VALUE 'AddressLine2'.
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
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Create dynamic WS-Header using REXX

Postby Pedro » Tue Apr 07, 2015 9:26 pm

the output sample posted seemed clear enough

Yeah, you guys answered the question that was asked. but you also belittled him for even asking the question. My assumption is that he is not experienced enough to ask the right question, nor to give the right sample results.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post