Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to remove BLANKS from the middle of Var

83 views
Skip to first unread message

Lizette Koehler

unread,
Jun 26, 2009, 12:32:56 PM6/26/09
to
I am working with LISTDSI and I would like to take the date created in SYSCREATE and make it more like June 01, 2006 or 01Jun06.

Since the filed comes back as 2006/150 I was giong to parse out the two fields and recombine then and then use the DATE function.

When I display my combined date I get 06__150 (_ represents a blank).

What am I doing wrong?

LISTDSI(My_Prof DIRECTORY NORECALL)

Jul_LL = Length(Syscreate)
Jul_Lngth = Pos('/',Syscreate)
Jul_Year = Strip(Substr(Syscreate,1,Jul_Lngth-1),'b')
Jul_Days = Strip(Substr(Syscreate,Jul_Lngth+1,Jul_ll),'b')
Jul_Date = Substr(Strip(Jul_Year,'b'),3,4)||Strip(Jul_days,'b')
Say " Create Date " SYSCREATE " " Jul_Date

From Trace

26 *-* Jul_LL = Length(Syscreate)
>V> "2006/150"
>F> "8"

27 *-* Jul_Lngth = Pos('/',Syscreate)
>L> "/"
>V> "2006/150"
>F> "5"

28 *-* Jul_Year = Strip(Substr(Syscreate,1,Jul_Lngth-1),'b')
>V> "2006/150"
>L> "1"
>V> "5"
>L> "1"
>O> "4"
>F> "2006"
>L> "b"
>F> "2006"

29 *-* Jul_Days = Strip(Substr(Syscreate,Jul_Lngth+1,Jul_ll),'b')
>V> "2006/150"
>V> "5"
>L> "1"
>O> "6"
>V> "8"
>F> "150 "
>L> "b"
>F> "150"

30 *-* Jul_Date = Substr(Strip(Jul_Year,'b'),3,4)||Strip(Jul_days,'b')
>V> "2006"
>L> "b"
>F> "2006"
>L> "3"
>L> "4"
>F> "06 "
>V> "150"
>L> "b"
>F> "150"

>O> "06 150"

31 *-* Say " Create Date " SYSCREATE " " Jul_Date
>L> " Create Date "
>V> "2006/150"
>O> " Create Date 2006/150"
>L> " "
>O> " Create Date 2006/150 "
>V> "06 150"
>O> " Create Date 2006/150 06 150"
Create Date 2006/150 06 150

Lizette

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Rabbe, Luke

unread,
Jun 26, 2009, 12:44:02 PM6/26/09
to
Do you only want to get a Substr here that is 2 characters long as
opposed to 4?

Jul_Date = Substr(Strip(Jul_Year,'b'),3,4)||Strip(Jul_days,'b')

Luke

Mark Zelden

unread,
Jun 26, 2009, 12:55:28 PM6/26/09
to
TSO REXX Discussion List <TSO-...@VM.MARIST.EDU> wrote on 06/26/2009
11:32:36 AM:

> I am working with LISTDSI and I would like to take the date created in
SYSCREATE and
> make it more like June 01, 2006 or 01Jun06.
>
> Since the filed comes back as 2006/150 I was giong to parse out the two
fields and
> recombine then and then use the DATE function.
>
> When I display my combined date I get 06__150 (_ represents a blank).
>
> What am I doing wrong?
>
> LISTDSI(My_Prof DIRECTORY NORECALL)
>
> Jul_LL = Length(Syscreate)
> Jul_Lngth = Pos('/',Syscreate)
> Jul_Year = Strip(Substr(Syscreate,1,Jul_Lngth-1),'b')
> Jul_Days = Strip(Substr(Syscreate,Jul_Lngth+1,Jul_ll),'b')
> Jul_Date = Substr(Strip(Jul_Year,'b'),3,4)||Strip(Jul_days,'b')
> Say " Create Date " SYSCREATE " " Jul_Date
>

<snip>

If I understand correctly, you want to reverse the strip/substr
on Jul_Date by changing:

Jul_Date = Substr(Strip(Jul_Year,'b'),3,4)||Strip(Jul_days,'b')

to

Jul_Date = Strip(Substr(Jul_Year,3,4),'b')||Strip(Jul_days,'b')

--
Mark Zelden
Sr. Software and Systems Architect - z/OS Team Lead
Zurich North America / Farmers Insurance Group - ZFUS G-ITO
mailto:mark....@zurichna.com
z/OS Systems Programming expert at
http://expertanswercenter.techtarget.com/
Mark's MVS Utilities: http://home.flash.net/~mzelden/mvsutil.html

******************* PLEASE NOTE *******************
This E-Mail/telefax message and any documents accompanying this
transmission may contain privileged and/or confidential information and is
intended solely for the addressee(s) named above. If you are not the
intended addressee/recipient, you are hereby notified that any use of,
disclosure, copying, distribution, or reliance on the contents of this
E-Mail/telefax information is strictly prohibited and may result in legal
action against you. Please reply to the sender advising of the error in
transmission and immediately delete/destroy the message and any
accompanying documents. Thank you.

Lizette Koehler

unread,
Jun 26, 2009, 12:56:20 PM6/26/09
to
Thanks everyone. That was my problem, 3,4 vs 3,2. Going between languages does make for some interesting issues.

Lizette


>
>Do you only want to get a Substr here that is 2 characters long as
>opposed to 4?
>

>Jul_Date = Substr(Strip(Jul_Year,'b'),3,4)||Strip(Jul_days,'b')
>
>

>Luke


>
>
>>I am working with LISTDSI and I would like to take the date created in
>SYSCREATE and make it more like June 01, 2006 or 01Jun06.
>
>Since the filed comes back as 2006/150 I was giong to parse out the two
>fields and recombine then and then use the DATE function.
>
>When I display my combined date I get 06__150 (_ represents a blank).
>
>What am I doing wrong?
>
>LISTDSI(My_Prof DIRECTORY NORECALL)
>
>Jul_LL = Length(Syscreate)
>Jul_Lngth = Pos('/',Syscreate)
>Jul_Year = Strip(Substr(Syscreate,1,Jul_Lngth-1),'b')
>Jul_Days = Strip(Substr(Syscreate,Jul_Lngth+1,Jul_ll),'b')
>Jul_Date = Substr(Strip(Jul_Year,'b'),3,4)||Strip(Jul_days,'b')
>Say " Create Date " SYSCREATE " " Jul_Date
>
>
>

----------------------------------------------------------------------

Dunkel, Martin

unread,
Jun 26, 2009, 1:09:11 PM6/26/09
to
Just as a side note, I often like parse var better. It is often
cleaner:

PARSE VAR SYSCREATE YYYY "/" DDD .
SAY YYYY DDD

Martin Dunkel
ECS - Release Management
National City, now a part of PNC

216-257-5354 (office)

Luke

LISTDSI(My_Prof DIRECTORY NORECALL)

From Trace

>O> "06 150"

Lizette


-------------------------------------------------------------------------------------------
***National City made the following annotations
-------------------------------------------------------------------------------------------
This communication is a confidential and proprietary business communication.
It is intended solely for the use of the designated recipient(s). If this
communication is received in error, please contact the sender and delete
this communication.
===========================================================================================

Ulrich Krueger

unread,
Jun 26, 2009, 1:14:21 PM6/26/09
to
Luke,
You should be able to use the DATE() function to read your Julian date value
and return a converted date format in something like mm/dd/yy or other
format.
See
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A370/4.3.16?S
HELF=EZ2ZO10K&DT=20060626210253
for more info.
If you need individual variables for Jul_year and Jul_days, you could try
something like
PARSE VAR Syscreate Jul_year "/" Jul_days
(not tested, I'm not near a mainframe right now)

HTH.

Regards,
Ulrich Krueger

Dunkel, Martin

unread,
Jun 26, 2009, 1:30:05 PM6/26/09
to
Lizette,

The date function does not convert Julian format to anything. You need
to do it yourself. Here is my simple solution:

You know the year, yyyy, so establish Jan 1 in base date format, add the
julian days (minus 1), then convert it back into whatever format you
want.

/* REXX */
trace ?i
my_prof="'$mpd1.pds.cmnlib1'"
rc = listdsi(my_prof directory norecall)

parse var syscreate yyyy "/" ddd .
j1="1 Jan" yyyy
j1_b=date("b",j1,"n")
j2_b=j1_b+ddd-1
j2=date("n",j2_b,"b")
exit

Martin Dunkel
ECS - Release Management
National City, now a part of PNC

216-257-5354 (office)

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Lizette Koehler
Sent: Friday, June 26, 2009 12:33 PM
To: TSO-...@VM.MARIST.EDU
Subject: [TSO-REXX] How to remove BLANKS from the middle of Var

LISTDSI(My_Prof DIRECTORY NORECALL)

From Trace

>O> "06 150"

Lizette

-------------------------------------------------------------------------------------------
***National City made the following annotations
-------------------------------------------------------------------------------------------
This communication is a confidential and proprietary business communication.
It is intended solely for the use of the designated recipient(s). If this
communication is received in error, please contact the sender and delete
this communication.
===========================================================================================

----------------------------------------------------------------------

Dunkel, Martin

unread,
Jun 26, 2009, 1:36:33 PM6/26/09
to
Lizette,

The variables I used, j1 and j2, don't really make much sense. I used
j1 to indicate Jan 1, then at the end I came up with a j2, which does
not mean Jan 2; rather, it is just your final output date converted to
the format you want.

Sorry about that. Use whatever variable names make sense to you.

216-257-5354 (office)

Lizette,

216-257-5354 (office)

LISTDSI(My_Prof DIRECTORY NORECALL)

From Trace

>O> "06 150"

Lizette

-------------------------------------------------------------------------------------------
***National City made the following annotations
-------------------------------------------------------------------------------------------
This communication is a confidential and proprietary business communication.
It is intended solely for the use of the designated recipient(s). If this
communication is received in error, please contact the sender and delete
this communication.
===========================================================================================

----------------------------------------------------------------------

Walter Pachl

unread,
Jun 26, 2009, 1:43:17 PM6/26/09
to
say translate('abcd efgh',syscreate,'abcdefgh') /* untested but only one
line */

Mark Zelden

unread,
Jun 26, 2009, 2:05:31 PM6/26/09
to
TSO REXX Discussion List <TSO-...@VM.MARIST.EDU> wrote on 06/26/2009
12:28:56 PM:

> Lizette,
>
> The date function does not convert Julian format to anything. You need
> to do it yourself. Here is my simple solution:
>

I have a date conversion routine on my web site (URL below) caled
RDATE. I wrote it prior to REXX supporting an input date conversion
format (OS/390 2.4). But it still can do some stuff the builtin
DATE function can't.

Mark


--
Mark Zelden
Sr. Software and Systems Architect - z/OS Team Lead
Zurich North America / Farmers Insurance Group - ZFUS G-ITO
mailto:mark....@zurichna.com
z/OS Systems Programming expert at
http://expertanswercenter.techtarget.com/
Mark's MVS Utilities: http://home.flash.net/~mzelden/mvsutil.html

******************* PLEASE NOTE *******************
This E-Mail/telefax message and any documents accompanying this
transmission may contain privileged and/or confidential information and is
intended solely for the addressee(s) named above. If you are not the
intended addressee/recipient, you are hereby notified that any use of,
disclosure, copying, distribution, or reliance on the contents of this
E-Mail/telefax information is strictly prohibited and may result in legal
action against you. Please reply to the sender advising of the error in
transmission and immediately delete/destroy the message and any
accompanying documents. Thank you.

----------------------------------------------------------------------

Schwarz, Barry A

unread,
Jun 26, 2009, 2:58:34 PM6/26/09
to
Since I use the date function to convert dates between many different
formats, including Julian, what am I misinterpreting about your
assertion?

-----Original Message-----
From: Dunkel, Martin

Sent: Friday, June 26, 2009 10:29 AM
To: TSO-...@VM.MARIST.EDU
Subject: Re: How to remove BLANKS from the middle of Var

Lizette,

The date function does not convert Julian format to anything. You need
to do it yourself. Here is my simple solution:

----------------------------------------------------------------------

Dunkel, Martin

unread,
Jun 26, 2009, 3:11:48 PM6/26/09
to
Barry,

I stand corrected!

Here is what it says in the Rexx manual:

Julian date in the format: yyddd.
Note: When used for date_format1, this option is valid only when
input_date is not specified.

I have just interpreted this to mean that Rexx doesn't convert Julian to
other formats. But, honestly, I never tried it. WOW!!!

Here's my code:

/* REXX */
trace ?i

dj="09177"
dt=date("n",dj,"j")
exit

Here's my trace:

3 *-* dj="09177"
>L> "09177"
4 *-* dt=date("n",dj,"j")

>L> "n"
>V> "09177"
>L> "j"
>F> "26 Jun 2009"
5 *-* exit
***

Looks good. THANKS!!!

Martin Dunkel
ECS - Release Management
National City, now a part of PNC

216-257-5354 (office)

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf

Of Schwarz, Barry A
Sent: Friday, June 26, 2009 2:57 PM
To: TSO-...@VM.MARIST.EDU

Lizette,

-------------------------------------------------------------------------------------------
***National City made the following annotations
-------------------------------------------------------------------------------------------
This communication is a confidential and proprietary business communication.
It is intended solely for the use of the designated recipient(s). If this
communication is received in error, please contact the sender and delete
this communication.
===========================================================================================

----------------------------------------------------------------------

Dunkel, Martin

unread,
Jun 26, 2009, 3:20:57 PM6/26/09
to
Barry,

So, regarding Lizette's original question, here is the simplified code I
came up with:

/* REXX */

my_prof="'$mpd1.pds.cmnlib1'"
rc = listdsi(my_prof directory norecall)

parse var syscreate yyyy "/" ddd .

yy=right(yyyy,2)
dj=yy||ddd

dt=date("n",dj,"j")

say dt
exit

Note: Rexx Julian format is yyddd with a 100 year sliding window. So,
that is why I am only using the right two characters of yyyy to get yy.

Martin Dunkel
ECS - Release Management
National City, now a part of PNC

216-257-5354 (office)

-----Original Message-----
From: Dunkel, Martin
Sent: Friday, June 26, 2009 3:11 PM
To: 'TSO REXX Discussion List'
Subject: RE: [TSO-REXX] How to remove BLANKS from the middle of Var

Barry,

I stand corrected!

Here is what it says in the Rexx manual:

Julian date in the format: yyddd.
Note: When used for date_format1, this option is valid only when
input_date is not specified.

I have just interpreted this to mean that Rexx doesn't convert Julian to
other formats. But, honestly, I never tried it. WOW!!!

Here's my code:

/* REXX */
trace ?i

dj="09177"
dt=date("n",dj,"j")
exit

Here's my trace:

3 *-* dj="09177"
>L> "09177"
4 *-* dt=date("n",dj,"j")

>L> "n"
>V> "09177"
>L> "j"
>F> "26 Jun 2009"
5 *-* exit
***

Looks good. THANKS!!!

Martin Dunkel


ECS - Release Management
National City, now a part of PNC

216-257-5354 (office)

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf

Of Schwarz, Barry A
Sent: Friday, June 26, 2009 2:57 PM
To: TSO-...@VM.MARIST.EDU

Lizette,

-------------------------------------------------------------------------------------------
***National City made the following annotations
-------------------------------------------------------------------------------------------
This communication is a confidential and proprietary business communication.
It is intended solely for the use of the designated recipient(s). If this
communication is received in error, please contact the sender and delete
this communication.
===========================================================================================

----------------------------------------------------------------------

Scott Gonyea

unread,
Jun 26, 2009, 3:29:51 PM6/26/09
to
Why so little love for TRANSLATE? You people make TRANSLATE sad :-(

****** ***************************** Top of Data
******************************
000001 /* REXX
***************************************************************/
000002 /* */
000003 /* List dataset information to get date (in SYSCREATE variable)
*/
000004 /* */
000005 x = LISTDSI("'CJAY.REXX' DIRECTORY NORECALL") /* x is unused */
000006 /* */
000007 /* Use 'TRANSLATE' method to transform text into DATE() readable
form */
000008 /* */
000009 /* Junk: vv v */
000010 crDate = TRANSLATE('YRDAT', SYSCREATE, '--YR/DAT')
000011 /* */
000012 SAY "Creation Date is:" crDate
000013 /* */
000014 /* Convert using DATE() method */
000015 nmDate = DATE(, crDate, 'J')
000016 SAY "Normalized Date is:" nmDate
000017 /* */
000018 /* EOF
****************************************************************/
****** **************************** Bottom of Data
****************************

Creation Date is: 08270
Normalized Date is: 26 Sep 2008
***


Yours,
Scott Gonyea
Enterprise Information Security Office


The information contained in this electronic message and any attachments
to this message is intended for the exclusive use of the addressee(s) and
may contain confidential or privileged information. If you are not the
intended recipient, please notify the sender at American Honda Motor Co.,
Inc. or scott_...@ahm.honda.com immediately and destroy all copies of
this message and any attachments.

Lizette Koehler <star...@mindspring.com>
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>
06/26/2009 09:32 AM
Please respond to
Lizette Koehler <star...@mindspring.com>


To
TSO-...@VM.MARIST.EDU
cc

Subject


[TSO-REXX] How to remove BLANKS from the middle of Var

Jeff Byrum

unread,
Jun 26, 2009, 3:38:50 PM6/26/09
to
Instead of:

parse var syscreate yyyy "/" ddd .
yy=right(yyyy,2)
dj=yy||ddd

you could just code this:

dj = TRANSLATE('34678',syscreate,'12345678')

PARSE is great when the tokens you want to isolate are variable in length, but if the format is fixed, as in this case, TRANSLATE works fine.

I'll admit I find the syntax a little hard to grasp, but all the above says is to take positions 3, 4, 6, 7 and 8 of the input string and put them together as one 5-char string, like this:

12345678
|| |||
yyyy/ddd

Dunkel, Martin

unread,
Jun 26, 2009, 3:40:41 PM6/26/09
to
Scott,

PARSE is a keyword instruction and TRANSLATE is a built-in function. I
have been told that PARSE has less overhead. But, who knows? I'm on a
downward "wrong" streak today. So, I could be wrong again. ;-)

I guess it's just a matter of preference. I usually prefer the fewest
lines of code to accomplish a task. And, I really like PARSE. PARSE
automatically strips leading and trailing blanks without having to tell
it to do so. And, I think the entire Rexx language was built around
PARSE.

Oh well, have a good weekend all...

Martin Dunkel
ECS - Release Management
National City, now a part of PNC

216-257-5354 (office)

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Scott Gonyea
Sent: Friday, June 26, 2009 3:29 PM
To: TSO-...@VM.MARIST.EDU


To
TSO-...@VM.MARIST.EDU
cc

LISTDSI(My_Prof DIRECTORY NORECALL)

From Trace

>O> "06 150"

Lizette

-------------------------------------------------------------------------------------------
***National City made the following annotations
-------------------------------------------------------------------------------------------
This communication is a confidential and proprietary business communication.
It is intended solely for the use of the designated recipient(s). If this
communication is received in error, please contact the sender and delete
this communication.
===========================================================================================

----------------------------------------------------------------------

Jeff Byrum

unread,
Jun 26, 2009, 3:42:11 PM6/26/09
to
Excellent! Much easier to understand than "34678"! Thanks!

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Scott Gonyea
Sent: Friday, June 26, 2009 3:29 PM
To: TSO-...@VM.MARIST.EDU

Dunkel, Martin

unread,
Jun 26, 2009, 3:43:52 PM6/26/09
to
OKAY, OKAY, OKAY, YOU BEAT ME! STOP THE INSANITY! ;-)

I'm heading home, chuckling.

Paul Gilmartin

unread,
Jun 26, 2009, 3:51:52 PM6/26/09
to
On 06/26/09 11:28, Dunkel, Martin wrote:
>
> The date function does not convert Julian format to anything. You need
> to do it yourself.
>
RTFM.

-- gil

Scott Gonyea

unread,
Jun 26, 2009, 3:53:05 PM6/26/09
to
Hi Martin,

I know what you're saying, but in my opinion... If overhead or speed are
ever an issue--interpreted languages shouldn't be used in the first place.
Everything should be about readability and maintainability, first and
foremost. Storage and CPU cycles have been cheaper than labor for decades
now, so it always blows my mind when I see a programmer taking the "long"
route.

Besides, I'm sure if you compile the REXX then it will be optimized so the
TRANSLATE is actually faster than the PARSE + variable assignments, etc.

Yours,
Scott Gonyea
Enterprise Information Security Office


The information contained in this electronic message and any attachments
to this message is intended for the exclusive use of the addressee(s) and
may contain confidential or privileged information. If you are not the
intended recipient, please notify the sender at American Honda Motor Co.,
Inc. or scott_...@ahm.honda.com immediately and destroy all copies of
this message and any attachments.

"Dunkel, Martin" <Martin...@NATIONALCITY.COM>


Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>

06/26/2009 12:39 PM
Please respond to


TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>


To
TSO-...@VM.MARIST.EDU
cc

Paul Gilmartin

unread,
Jun 26, 2009, 3:57:29 PM6/26/09
to
On 06/26/09 10:32, Lizette Koehler wrote:
> I am working with LISTDSI and I would like to take the date created in SYSCREATE and make it more like June 01, 2006 or 01Jun06.
>
> Since the filed comes back as 2006/150 I was giong to parse out the two fields and recombine then and then use the DATE function.
>
> When I display my combined date I get 06__150 (_ represents a blank).
>
> What am I doing wrong?
>
I've not read this thread to the end, but how about:

user@MVS:139$ rexx "trace R; Syscreate = '2006/150';
say date( 'N', substr( Syscreate, 3, 2 )right( Syscreate, 3 ), 'J' )"
1 *-* Syscreate = '2006/150'
>>> "2006/150"
*-* say date( 'N', substr( Syscreate, 3, 2 )right( Syscreate, 3 ), 'J' )
>>> "30 May 2006"
30 May 2006
user@MVS:139$

-- gil

Scott Gonyea

unread,
Jun 26, 2009, 3:58:21 PM6/26/09
to
Oh no you di'int

Yours,
Scott Gonyea
Enterprise Information Security Office


The information contained in this electronic message and any attachments
to this message is intended for the exclusive use of the addressee(s) and
may contain confidential or privileged information. If you are not the
intended recipient, please notify the sender at American Honda Motor Co.,
Inc. or scott_...@ahm.honda.com immediately and destroy all copies of
this message and any attachments.

Paul Gilmartin <PaulGB...@AIM.COM>


Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>

06/26/2009 12:50 PM


Please respond to
TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>


To
TSO-...@VM.MARIST.EDU
cc

Subject
Re: [TSO-REXX] How to remove BLANKS from the middle of Var

Paul Gilmartin

unread,
Jun 26, 2009, 5:06:42 PM6/26/09
to
On 06/26/09 13:56, Scott Gonyea wrote:
> Oh no you di'int
>
In fact, true; but I have now, and I stand by my assertion.

> Paul Gilmartin <PaulGB...@AIM.COM>
> Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>
> 06/26/2009 12:50 PM
>

> On 06/26/09 11:28, Dunkel, Martin wrote:
>> The date function does not convert Julian format to anything. You need
>> to do it yourself.
>>
> RTFM.
>

I mean:

4.3.16 "z/OS V1R7.0 TSO/E REXX Reference"
___________________________________________________________________
4.3.16 DATE
________________________________________________________________________
| |
| >>__DATE__(__ __________________________________________________ ____> |
| |_date_format1_ ________________________________ __| |
| | |_,input_date_ _______________ __| | |
| | |_,date_format2_| | |
| |_,input_date_ _______________ ____________________| |
| |_,date_format2_| |
| |
| >__)________________________________________________________________>< |
| |
|________________________________________________________________________|

returns, by default, the local date in the format: dd mon yyyy (day,
month, year--for example, 25 Dec 2001), with no leading zero or blank on
the day. Otherwise, the string input_date is converted to the format
specified by date_format1. date_format2 can be specified to define the
current format of input_date.

... which tells how to use DATE() to convert one date format to
another. A couple other plies in this thread have made similar
suggestions.

Gardiner, Roy , UK Europe and Middle East, Technology Services

unread,
Jun 29, 2009, 5:19:06 AM6/29/09
to
Preference, and what's to be done.

TRANSLATE is for when simplification or transformation is required at
the individual character level. It is so powerful that if you have such
a problem* a good approach is 'The answer is TRANSLATE; now, how do I do
it?' PARSE is better for manipulating blocks of characters and
especially for when what is found influences how the parse continues.


'I have a string. It may contain any character. I wish to form a
string 26 characters long, '1' in the first position if my string
contains at least one 'A', '0' if it does not, and so on'.

> *** WARNING : This message originates from the Internet ***
>
>
The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB

Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate.

Gardiner, Roy , UK Europe and Middle East, Technology Services

unread,
Jun 29, 2009, 5:39:21 AM6/29/09
to
Martin, I think your interpretation is common. I have not written Rexx
in anger for some years, read this thread, got fooled again.

The manual might, IMO, be worded better -- I hope this is right... :-)

'Date() can be used to convert between any of the Rexx formats, with one
exception. It will not convert *to* Julian format (converting *from*
Julian format is possible).'

> -----Original Message-----
> From: TSO REXX Discussion List

> [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Dunkel, Martin

> *** WARNING : This message originates from the Internet ***
>
>
The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB

Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate.

----------------------------------------------------------------------

Hamilton Phd, Robert L

unread,
Jun 29, 2009, 9:05:48 AM6/29/09
to
It's true in OBJREXX also: got this error

Oooops ! ... try again. Incorrect call to routine
DATE argument 1 must be one of BDELMNOSUW;
found "J"
rc = 40 ....................................... Program on WindowsNT

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] Subject:
Re: How to remove BLANKS from the middle of Var

Martin, I think your interpretation is common. I have not written Rexx
in anger for some years, read this thread, got fooled again.

The manual might, IMO, be worded better -- I hope this is right... :-)

'Date() can be used to convert between any of the Rexx formats, with one
exception. It will not convert *to* Julian format (converting *from*
Julian format is possible).'

Dunkel, Martin

unread,
Jun 29, 2009, 9:22:39 AM6/29/09
to
Roy,

Thanks for the clarification. Thinking back, this was my understanding.
But, in this case, I just had it backwards.

Anyway, it has always bothered me that if the DATE function is so
versatile, converting from and to every date format under the sun, why
will it not convert "to" Julian format. Do we need to wait for a new
release of Rexx for that?

Paul Gilmartin

unread,
Jun 29, 2009, 9:27:02 AM6/29/09
to
On Jun 29, 2009, at 03:39, Gardiner, Roy (UK Europe and Middle East,

Technology Services) wrote:
>
> 'Date() can be used to convert between any of the Rexx formats,
> with one
> exception. It will not convert *to* Julian format (converting *from*
> Julian format is possible).'
>
This is indeed a bizarre restriction. Does anyone know
the rationale for it?

-- gil

Gardiner, Roy , UK Europe and Middle East, Technology Services

unread,
Jun 29, 2009, 9:37:39 AM6/29/09
to
Dregs of memory, it's an ambiguity in Julian format -- but *don't* put
money on it.

Mike Cowlishaw wrote the entire first implementation of Rexx, with all
the functions. As he is a bit clever, there will be a good reason, I'm
sure.

> -----Original Message-----
> [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Dunkel, Martin

> Subject: Re: How to remove BLANKS from the middle of Var
>
>

> Anyway, it has always bothered me that if the DATE function
> is so versatile, converting from and to every date format
> under the sun, why will it not convert "to" Julian format.
> Do we need to wait for a new release of Rexx for that?
>
> Martin Dunkel
> ECS - Release Management
> National City, now a part of PNC

Schwarz, Barry A

unread,
Jun 29, 2009, 3:26:41 PM6/29/09
to
Since it will convert today's date to Julian, maybe your text should
read "... will not convert a specified date to ...".

-----Original Message-----
From: Gardiner, Roy (UK Europe and Middle East, Technology Services)
[mailto:roy.ga...@RBS.CO.UK]
Sent: Monday, June 29, 2009 2:39 AM
To: TSO-...@VM.MARIST.EDU
Subject: Re: How to remove BLANKS from the middle of Var

Martin, I think your interpretation is common. I have not written Rexx
in anger for some years, read this thread, got fooled again.

The manual might, IMO, be worded better -- I hope this is right... :-)

'Date() can be used to convert between any of the Rexx formats, with one
exception. It will not convert *to* Julian format (converting *from*
Julian format is possible).'

----------------------------------------------------------------------

Schwarz, Barry A

unread,
Jun 29, 2009, 3:28:10 PM6/29/09
to
Possibly because the "D" conversion does all the hard work for a
specified date which will already include the year.

-----Original Message-----
From: Dunkel, Martin
Sent: Monday, June 29, 2009 6:22 AM
To: TSO-...@VM.MARIST.EDU
Subject: Re: How to remove BLANKS from the middle of Var

Roy,

Thanks for the clarification. Thinking back, this was my understanding.
But, in this case, I just had it backwards.

Anyway, it has always bothered me that if the DATE function is so
versatile, converting from and to every date format under the sun, why
will it not convert "to" Julian format. Do we need to wait for a new
release of Rexx for that?

----------------------------------------------------------------------

Gardiner, Roy , UK Europe and Middle East, Technology Services

unread,
Jun 30, 2009, 4:41:16 AM6/30/09
to
Sounds right.

:-) I congratulate myself that the wording was clear enough for the
error to be spotted easily.

> -----Original Message-----
> [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Schwarz, Barry A

> Subject: Re: How to remove BLANKS from the middle of Var
>
> Since it will convert today's date to Julian, maybe your text
> should read "... will not convert a specified date to ...".
>
> -----Original Message-----
> From: Gardiner, Roy (UK Europe and Middle East, Technology
> Services) [mailto:roy.ga...@RBS.CO.UK]
> Sent: Monday, June 29, 2009 2:39 AM
> To: TSO-...@VM.MARIST.EDU
> Subject: Re: How to remove BLANKS from the middle of Var
>
> Martin, I think your interpretation is common. I have not
> written Rexx in anger for some years, read this thread, got
> fooled again.
>
> The manual might, IMO, be worded better -- I hope this is right... :-)
>
> 'Date() can be used to convert between any of the Rexx
> formats, with one exception. It will not convert *to* Julian
> format (converting *from* Julian format is possible).'

The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB

Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate.

----------------------------------------------------------------------

Grant Ward Able

unread,
Jul 13, 2009, 3:34:33 AM7/13/09
to
Looks like everyone who codes in REXX knows all they need to, cos nothing
is happening on this forum!

--
Regards - Grant
=====================================
Note: Any opinion expressed is my own


<BR>_____________________________________________________________
<FONT size=2><BR>
DTCC DISCLAIMER: This email and any files transmitted with it are
confidential and intended solely for the use of the individual or
entity to whom they are addressed. If you have received this email
in error, please notify us immediately and delete the email and any
attachments from your system. The recipient should check this email
and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted
by this email.</FONT>

John P Kalinich

unread,
Jul 13, 2009, 7:56:31 AM7/13/09
to
Grant Ward Able of the TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>

wrote on 07/13/2009 02:34:16 AM:

> Looks like everyone who codes in REXX knows all they need to, cos nothing
> is happening on this forum!

Does anyone have code to parse an Excel spreadsheet in comma separated
value (csv) format? How do you handle the embedded commas inside of double
quotes?

Regards,
John K

Lizette Koehler

unread,
Jul 13, 2009, 8:29:13 AM7/13/09
to
I am not sure if this would work, but if I were working on this as a flat
file in REXX on MVS, I might do the following:

In REXX, Copy the file to a temp file.
If the file has commas that I need, then I would use an ISPF EDIT MACRO on
the temp file and change all "," to something else (spaces or a unique char)
Then parse based on spaces or the unique char.

Or if there are no other commas other than the "," then I would translate
the double quotes to spaces, then parse using the commas as the delimiters.


Lizette

>
> > Looks like everyone who codes in REXX knows all they need to, cos
nothing
> > is happening on this forum!
>
> Does anyone have code to parse an Excel spreadsheet in comma separated
> value (csv) format? How do you handle the embedded commas inside of
double
> quotes?
>

----------------------------------------------------------------------

Paul Gilmartin

unread,
Jul 13, 2009, 8:58:24 AM7/13/09
to
On Jul 13, 2009, at 05:56, John P Kalinich wrote:

> Grant Ward Able of the TSO REXX Discussion List <TSO-

> RE...@VM.MARIST.EDU>


> wrote on 07/13/2009 02:34:16 AM:
>
>> Looks like everyone who codes in REXX knows all they need to, cos
>> nothing
>> is happening on this forum!
>
> Does anyone have code to parse an Excel spreadsheet in comma separated
> value (csv) format? How do you handle the embedded commas inside
> of double
> quotes?
>

Faced with this task once, but having the original .xls at hand,
I opened it with OpenOffice.org and Saved As .html.

o No problem with embedded commas.

o My original was a multi-sheet document and I was able to Save
all sheets in a single .html document. .csv can only Save each
sheet as a separate document.

(my target processing language was awk, but the same considerations
would apply to Rexx.)

-- gil

Farley, Peter x23353

unread,
Jul 13, 2009, 8:58:54 AM7/13/09
to
> -----Original Message-----
> From: TSO REXX Discussion List
> [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of John P Kalinich
> Sent: Monday, July 13, 2009 7:56 AM
> To: TSO-...@VM.MARIST.EDU
> Subject: [TSO-REXX] Parse Excel .csv Files (Was: [TSO-REXX]
> Nothing happening)
<Snipped>
> Does anyone have code to parse an Excel spreadsheet in comma separated
> value (csv) format? How do you handle the embedded commas
> inside of double
> quotes?

I have a pretty accurate algorithm for that, but it's written in unix
awk. I may get a chance to translate that to REXX this week, I'll get
back to you.

Peter
This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.

Noack, Steve

unread,
Jul 13, 2009, 9:18:34 AM7/13/09
to
This code snippet is from a process I wrote that parses through an SQL statement. It was coded to look for a terminating semi-colon and needed to make sure the semi-colon was not quote embedded.

It's not pretty, but it does the trick. Maybe it will give you enough direction to apply in your situation.

in_quote_1 = 0 /* Boolean - in 'single' quotes */
in_quote_2 = 0 /* Boolean - in "double" quotes */

do i = 1 to length(work_field) /* working through the field */
char = substr(work_field,i,1) /* get the next character */
if char = "'" & \in_quote_2 then /* if sngl qt and not in dbl qts */
in_quote_1 = \in_quote_1 /* flip sngl qt flag */
if char = '"' & \in_quote_1 then /* if dbl qt and not in sngl qts */
in_quote_2 = \in_quote_2 /* flip dbl qt flag */
if char = ';' & (\in_quote_1 & \in_quote_2) then /* semi & not in qts */
leave /* found terminator - quit parsing*/
end


Hope it helps.

Thanks,
Steve

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of John P Kalinich
Sent: Monday, July 13, 2009 6:56 AM
To: TSO-...@VM.MARIST.EDU

Regards,
John K


-----Message Disclaimer-----

This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Con...@principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.

Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.

While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.

Don Leahy

unread,
Jul 13, 2009, 9:35:18 AM7/13/09
to
The last time I ran into this requirement I had no success producing a
general purpose solution. There were too many differences from one
version of the spreadsheet to the next, so we eventually gave up
chasing a moving target. Fortunately we were able to convince the
owner of the data to produce an XML version. This format has proved
to be much more stable than the old spreadsheet.

Scott Gonyea

unread,
Jul 13, 2009, 12:59:11 PM7/13/09
to
This is a very simple process on UNIX (Perl/Ruby). If you have Perl
installed on OMVS, you can always try this:

http://www.perlmeme.org/tutorials/parsing_csv.html


One question is how the CSV is formatted and (importantly) how quotes are
escaped. But assuming they're not doing anything overly complex, your
process would look like:

Trim first character (a double-quote)
Trim last character (a double-quote)
Split line on each occurence of "," (double-quote, comma, double-quote)

At the top of your REXX program, declare how many values you expect to
get--and compare that to what you actually got. This is your "oh shit"
logic and you should trigger an e-mail so you can go yell at the person in
accounting who broke your precious REXX script to rule them all.

Yours,
Scott Gonyea
Enterprise Information Security Office

(310) 972-4495


The information contained in this electronic message and any attachments
to this message is intended for the exclusive use of the addressee(s) and

may contain confidential or privileged information. If you are not the


intended recipient, please notify the sender at American Honda Motor Co.,

Inc. or scott_...@ahm.honda.com immediately and destroy all copies of
this message and any attachments.

John P Kalinich <jkal...@CSC.COM>
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>
07/13/2009 04:56 AM
Please respond to


TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>


To
TSO-...@VM.MARIST.EDU
cc

Subject
[TSO-REXX] Parse Excel .csv Files (Was: [TSO-REXX] Nothing happening)

John P Kalinich

unread,
Jul 13, 2009, 1:57:27 PM7/13/09
to
This is the hack I came up with...

line.one = '"Rotten, John P.",CSC,Sysprog,"210 N. Tucker St., St. Louis,
MO"'
Do Forever
a = Pos('"',line.one)
If a > 0 Then
Do
b = Pos('"',line.one,a + 1)
Do x = a To b
line.one = Overlay(' ',line.one,a,1)
line.one = Overlay(' ',line.one,b,1)
Do y = a To b
If Substr(line.one,y,1) = ',' Then
line.one = Overlay(' ',line.one,y,1)
End
End
Iterate
End
Else
Leave
End
line.one = Space(line.one,1)
Parse Var line.one,
line.name,
',' line.org,
',' line.title,
',' line.address,
',' .
Say Strip(line.name)
Say Strip(line.org)
Say Strip(line.title)
Say Strip(line.address)


TSO REXX Discussion List <TSO-...@VM.MARIST.EDU> wrote on 07/13/2009

08:18:23 AM:

> "Noack, Steve" <Noack...@PRINCIPAL.COM>
> Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>
>
> 07/13/2009 08:18 AM
>
> Please respond to


> TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>
>

> To
>
> TSO-...@VM.MARIST.EDU
>
> cc
>
> Subject
>
> Re: [TSO-REXX] Parse Excel .csv Files (Was: [TSO-REXX] Nothing

Arthur T.

unread,
Jul 13, 2009, 2:18:04 PM7/13/09
to
On 13 Jul 2009 04:56:31 -0700, in bit.listserv.tsorexx
(Message-ID:<OFF9D30D64.3FBBEAD4-ON852575...@csc.com>)

jkal...@CSC.COM (John P Kalinich) wrote:

>Does anyone have code to parse an Excel spreadsheet in
>comma separated
>value (csv) format? How do you handle the embedded commas
>inside of double
>quotes?

I haven't used it, but you might look at the code here:
http://www.sahananda.fwbo.net/Rexx/csvline.rex

--
I cannot receive mail at the address this was sent from.
To reply directly, send to ar23hur "at" intergate "dot" com

Frank Clarke

unread,
Jul 13, 2009, 5:19:12 PM7/13/09
to
On 13 Jul 2009 00:34:33 -0700, GWar...@DTCC.COM (Grant Ward Able) wrote:
<OF2AD6714A.53E505CC-ON802575...@dtcc.com>

>Looks like everyone who codes in REXX knows all they need to, cos nothing
>is happening on this forum!

Part of the problem is that REXX is so easy to learn, after you ask three or
four questions you're able to figure everything else out on your own...


(change Arabic number to Roman numeral to email)

Robert Zenuk

unread,
Jul 13, 2009, 6:39:11 PM7/13/09
to
Here is my hack... As always sorry if the indenting gets lost...


"EXECIO * DISKR CSVIN (STEM CSVIN. FINIS"
do i=1 to csvin.0
csvline = strip(csvin.i)
varcount = 0
do forever
varcount = varcount + 1
select
when csvline = '' then
leave
when left(csvline,2) �= ',"' &,
left(csvline,1) = ',' then
parse var csvline ',' value csvline
when left(csvline,1) = ',' then
parse var csvline ',' '"' value '"' csvline
when left(csvline,1) �= '"' & varcount = 1 then
parse var csvline value csvline
otherwise
parse var csvline '"' value '"' csvline
end
var.varcount = value
end
say 'CSV Record' right(i,5)
do v=1 to varcount-1
say 'Field' right(v,3)':' var.v
end
end


JCL

//CSVPARSE EXEC PGM=IKJEFT01,PARM=CSVPARSE
//SYSEXEC DD DSN=your.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//CSVIN DD DSN=your.csv.file,DISP=SHR

Hope this helps,

Rob

In a message dated 7/13/2009 10:57:23 A.M. US Mountain Standard Time,
jkal...@CSC.COM writes:

> > Looks like everyone who codes in REXX knows all they need to, cos
nothing
> > is happening on this forum!
>

> Does anyone have code to parse an Excel spreadsheet in comma separated
> value (csv) format? How do you handle the embedded commas inside of
double
> quotes?
>

> Regards,
> John K

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX


**************Summer concert season is here! Find your favorite artists on
tour at TourTracker.com.
(http://www.tourtracker.com/?ncid=emlcntusmusi00000006)

Itschak Mugzach

unread,
Jul 14, 2009, 1:21:43 AM7/14/09
to
Hi,

I would try this simple program:

/* MugiRexx ;-) */
Sample1:
Signal Sample1.Main
Sample1.Doc:

-----------------------------------------------------------------------------------------------------------
The program demonstrate how to move a comma embeded between two
quotes.

i_mu...@securiteam.co.il

------------------------------------------------------------------------------------------------------------
Sample.Main:
"EXECIO * DiskR CSVIN (Stem CSVIN. FINIS"
Do i-1 ro CSVIN.0
XString = CSVIN.I
NewString = ''
Do While (String ne '')
Parse var XString Xvar1 XString
Var1 = Translate(Var1,' ',',')
NewString = NewString ',' Var /* Re-construct the record */
End
End

Have fun,

Itschak

Itschak Mugzach

unread,
Jul 14, 2009, 1:36:27 AM7/14/09
to
Opps... The Parse var should look like this 'Parse var xstring Xvar1 xcomma
Xstring

Itschak

0 new messages