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

Rexx and CVS files

211 views
Skip to first unread message

Martin Dunkel

unread,
Feb 5, 2015, 12:45:39 PM2/5/15
to
Does anyone have a subroutine or function built to parse csv data???

It looks like my data is basically separated by commas:
field1,field2,field3

However...

If the field contains a comma or multiple commas then the whole field is
contained within double quotes:
field1,"a,b,c",field3

If the field contains a double quote, then this is represented by two
double quotes:
field1,"a b "" c d",field3

If the field contains a single quote then nothing special is done:
field1,field2',field3

And, obviously, if there is no data in a field, you get:
field1,,field3

There are 40 fields in each record, and 2,635 records in the file I am
working with, so it's not a huge file.

By the way, SAS handles this pretty nicely with:
DATA MMS;
INFILE MMSIN DLM='6B'X DSD LRECL=6000 TRUNCOVER;

INPUT V1 :$8.
V2 :$8.
V3 :$80.
;

I am just looking for a Rexx solution.

Thanks! MPD

Martin Dunkel
Change and Release Management Analyst
Change & Release Management

PNC Financial - Enterprise Computing Services
4100 West 150th Street (Locator: B7-YB17-02-1)
Cleveland, OH 44135

(ph) 216.257.5354 | (c) 440.822.8178 | (fx) 216.257.8997
martin...@pnc.com



The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to read it. If you think you received it in error, please notify the sender. Do not forward or copy without permission of the sender. This message may be considered a commercial electronic message under Canadian law or this message may contain an advertisement of a product or service and thus may constitute a commercial electronic mail message under US law. You may unsubscribe at any time from receiving commercial electronic messages from PNC at http://pages.e.pnc.com/globalunsub/
PNC, 249 Fifth Avenue, Pittsburgh, PA 15222; pnc.com



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

Walter Pachl

unread,
Feb 5, 2015, 1:05:58 PM2/5/15
to
A quick hack:

/*
field1,field2,field3
field1,"a,b,c",field3
field1,"a b "" c d",field3
field1,field2',field3
field1,,field3
*/
fid='test.csv'
Do While lines(fid)>0
l=linein(fid)
instring=0
ol=''
k=0
Do i=1 To length(l)
Parse Var l c +1 l
Select
When c='"' Then Do
If instring Then Do
Parse Var l c +1 l
If c='"' Then
ol=ol||c
Else Do
instring=0
If c=',' Then Do
k+=1
Say k ol
ol=''
End
Else
ol=ol||c
End
End
Else
instring=1
End
When c=',' Then Do
If instring Then
ol=ol||c
Else Do
k+=1
Say k ol
ol=''
End
End
Otherwise
ol=ol||c
End
End
k+=1
Say k ol
Say '--'
End
Seems to work
Linein-> EXECIO and beautification left to you
Walter

-----Ursprüngliche Nachricht-----
Von: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] Im Auftrag von
Martin Dunkel
Gesendet: Donnerstag, 05. Februar 2015 18:44
An: TSO-...@VM.MARIST.EDU
Betreff: [TSO-REXX] Rexx and CVS files

Robert Zenuk

unread,
Feb 5, 2015, 8:41:38 PM2/5/15
to
Here is the gist of what I use. It is a pared down version of my CSVSTEM routine that not only parses a CSV file but builds a statistical analysis of the data as it parses and creates an in-memory model of the data (with indexes) for slicing and dicing. No reason to duplicate Excel processing, but a helpful approach when you want to process the data on the mainframe to pass results to subsequent steps. Unfortunately, I can't share that routine... This basic version gets the point across.

/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Parse a CSV file */
/*-------------------------------------------------------------------*/
/* Syntax: CSVPARSE */
/*-------------------------------------------------------------------*/
/* Parms: N/A - N/A */
/* */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jul 2009 Initial Creation */
/* */
/*********************************************************************/
/* Replaceable character to handle double quotes inside a field */
/*********************************************************************/
repchar = '``'
/*********************************************************************/
/* Read input CSV records */
/*********************************************************************/
"EXECIO * DISKR CSVIN (STEM CSVIN. FINIS"
say csvin.0 'records'
/*********************************************************************/
/* Assume record 1 is the header record with column headings */
/*********************************************************************/
vars = strip(translate(translate(csvin.1,'_',' '),' ',','),'B','_')
outline.1 = csvin.1
varcount = words(vars)
say varcount 'variables'
/*********************************************************************/
/* Prime variable stems for summary data for each variable */
/*********************************************************************/
do v=1 to varcount
var = word(vars,v)
uniq.var = ''
end
/*********************************************************************/
/* Loop through remaining records */
/*********************************************************************/
do i=2 to csvin.0
csvline = strip(chgstr(csvin.i,repchar,'""'))
outline.i = ''
/*********************************************************************/
/* Parse each variable value */
/*********************************************************************/
do v=1 to varcount
csvline = strip(csvline,'L',',')
select
when csvline = '' then
leave
when left(csvline,1) = '"' then
parse var csvline '"' value '"' csvline
otherwise
parse var csvline value ',' csvline
end
/*********************************************************************/
/* Keep unique value list */
/*********************************************************************/
var = word(vars,v)
if wordpos(value,uniq.var) = 0 then
uniq.var = uniq.var value
/*********************************************************************/
/* Stem the value */
/*********************************************************************/
call value var'.'i,value
outline.i = outline.i value
end
outline.i = strip(chgstr(outline.i,'"',repchar))
end
/*********************************************************************/
/* Write the output file */
/*********************************************************************/
"EXECIO * DISKW OUTLINE (STEM OUTLINE. FINIS"
/*********************************************************************/
/* Print a summary of the variables */
/*********************************************************************/
do v=1 to varcount
var = word(vars,v)
say words(uniq.var) 'unique values for variable' var
end
exit 0
/*********************************************************************/
/* Change strings (works like translate) */
/*********************************************************************/
chgstr: procedure
parse arg string, new, old
lnew = length(new)
lold = length(old)
x = 1
do forever
if pos(old,string,x) = 0 then return string
x = pos(old,string,x)
string = insert(new,delstr(string,x,lold),x-1,lnew)
x = x + length(new)
end

Sample JCL:

//jobcard...
//CSVPARSE EXEC PGM=IKJEFT01,PARM=CSVPARSE
//SYSEXEC DD DSN=MY.EXEC,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//CSVIN DD DSN=YOUR.INPUT.CSVFILE,DISP=SHR
//OUTLINE DD SYSOUT=* (direct wherever appropriate)


Many times row 1 of a CSV file is the column headings. While the OUTLINE DD will produce a space delimited version of the file, you might need more formatting capabilities. This routine place each value of each row in its own stem based on the header row.

So a sample file:

DATE,TIME,NAME
01/01/2015,08:00,ROB
01/02/2015,09:00,FRED
02/05/2015,10:00,BILL
02/05/2015,,"BOB JOHNSON"

would yield:

date.1 = '01/01/2015'
time.1 = '08:00'
name.1 = 'ROB'
date.2 = '01/02/2015'
time.2 = '09:00'
name.2 = 'FRED'

date.3 = '02/05/2015'
time.3 = '10:00'
name.3 = 'BILL'

date.4 = '02/05/2015'
time.4 = ''
name.4 = 'BOB JOHNSON'


If you know your column headings you can format any way you need.


Hope this helps,

Rob

P.S. If indentation is not preserved, let me know and I'll send you a copy as an attachment.

Steve Coalbran

unread,
Feb 6, 2015, 2:04:47 AM2/6/15
to
Hi Walter, Martin
On TSO anyhow
2 +++ k+=1
IRX0035I Error running SPLUG, line 2: Invalid expression
as this construct is not available in TSO REXX.
k=k+1 is a simple change. Not sure what platform we are talking about.

I actually have a tool that I am currently in the process of improving,
called imaginatively 'CSV'. It's a TSO REXX/ISPF Dialogue.
At the moment it's quite simple and just really displays CSV data in
BROWSE in columns with a custom data parses to colourise it.

? Browsing the dataset ...
DSLIST - Data Sets Matching SE16661.CSV* Row 18
of 18
Command ===> Scroll ===>
CSR

Command - Enter "/" to select action Message Volume
-------------------------------------------------------------------------------
B SE16661.CSVTEST.CSV CSV RC=0 Z00U14

***************************** End of Data Set list
****************************

? Might look like this:
BROWSE SE16661.CSVTEST.CSV Line 00000000 Col
001 080
Command ===> Scroll ===>
CSR
********************************* Top of Data
**********************************
ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,NINE,TEN
UN,DEUX,TROIS,QUATRE,CINQ,SIX,SEPT,HUIT,NEUF,DIX
UNO,DOS,TRES,CUATRO,CINCO,SEIS,SIETE,OCHO,NUEVE,DIEZ
UNO,DUE,TRE,QUATTRO,CINQUE,SEI,SETTE,OTTO,NOVE,DIECI
EIENS,ZWEI,DREI,VIER,FüNF,SECHS,SIEBEN,ACHT,NEUN,ZEHN
JEDNA,DVA,TRI,CTYRI,PET,SEST,SEDM,OSM,DEVET,DESET
******************************** Bottom of Data
********************************

? Using the CSV tool ...
DSLIST - Data Sets Matching SE16661.CSV* Row 18
of 18
Command ===> Scroll ===>
CSR

Command - Enter "/" to select action Message Volume
-------------------------------------------------------------------------------
CSV SE16661.CSVTEST.CSV CSV RC=0 Z00U14

***************************** End of Data Set list
****************************

? would prompt for column delimiter ...
DSLIST - Data Sets Matching SE16661.CSV* Row 18
of 18
Command ===> Scroll ===>
CSR

Command - Enter "/" to select action Message Volume
-------- +-------- CSV ---------+
---------------------------------------------
CSV | | CSV RC=0 Z00U14

******** | Column delimiter: | of Data Set list
****************************
| 3 1. Tab |
| 2. Semicolon |
| 3. Comma |
| 4. Space |
| 5. Other |
| |
| PF 1=Help 2=Split |
| PF 3=End |
+----------------------+

? then appends a status indicator (inappropriate so simulated here for
such a small file)...
+---- Build Status ----+
| ???????????????? 80% |
| 4 records read |
+----------------------+

? then displays in columnar fashion...
BROWSE SE16661.CSVTEST.CSV - Cols Line 00000000 Col
001 080
Command ===> Scroll ===>
CSR
********************************* Top of Data
**********************************
ONE ŚTWO ŚTHREEŚFOUR ŚFIVE ŚSIX ŚSEVEN ŚEIGHTŚNINE ŚTEN
UN ŚDEUXŚTROISŚQUATRE ŚCINQ ŚSIX ŚSEPT ŚHUIT ŚNEUF ŚDIX
UNO ŚDOS ŚTRES ŚCUATRO ŚCINCO ŚSEIS ŚSIETE ŚOCHO ŚNUEVEŚDIEZ
UNO ŚDUE ŚTRE ŚQUATTROŚCINQUEŚSEI ŚSETTE ŚOTTO ŚNOVE ŚDIECI
EIENSŚZWEIŚDREI ŚVIER ŚFüNF ŚSECHSŚSIEBENŚACHT ŚNEUN ŚZEHN
JEDNAŚDVA ŚTRI ŚCTYRI ŚPET ŚSEST ŚSEDM ŚOSM ŚDEVETŚDESET
******************************** Bottom of Data
********************************
Column separators are all PINK. It currently (falsely) assumes all files
include a Header row and colours this PINK+REVERSE ...


Version 2 will have more flexibility but I am working on it in my own time
at weekends (and rather spasmodically at that!) so may be a while.

/Steve
--- Martin Dunkel original deleted ---




Sĺvida annat inte anges ovan: / Unless stated otherwise above:
IBM Svenska AB
Organisationsnummer: 556026-6883
Adress: 164 92 Stockholm

Walter Pachl

unread,
Feb 6, 2015, 3:01:38 AM2/6/15
to
That's beautification :-)
K=k+1
In the forthcoming REXXLA Symposium in Vienna (plug plug) I shall be talking
about Classic REXX
(and I should have considered TSO -- but k+=1 is so neat, isn't it)
Walter

-----Ursprüngliche Nachricht-----
Von: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] Im Auftrag von
Steve Coalbran
Gesendet: Freitag, 06. Februar 2015 08:04
An: TSO-...@VM.MARIST.EDU
Betreff: Re: [TSO-REXX] AW: [TSO-REXX] Rexx and CVS files

Hi Walter, Martin
On TSO anyhow
2 +++ k+=1

Robert Zenuk

unread,
Feb 6, 2015, 8:59:35 AM2/6/15
to
Similarly, I used an ISPF table as a target for some stuff to help formatting by using File Tailoring on the output side...

Here is a version called CSV2TAB that loads a CSV file into an ISPF table. This REQUIRES that row 1 of the CSV file contains row headers and the row headers CONFORM to ISPF variable naming conventions. It only produces a temporary table and throws it away at the end. It can be a template for more elaborate stuff. If you put valid TBCLOSE logic in place you can use the generic ISPF Table Utility (ISPF 3.16 I think) to view it.

/*********************************************************************/
/* REXX */
/*********************************************************************/
/* Purpose: Build an ISPF Table from a CSV file with headers */
/*-------------------------------------------------------------------*/
/* Syntax: CSV2TAB */
/*-------------------------------------------------------------------*/
/* Parms: N/A - N/A */
/* */
/* Notes: Row 1 MUST be column headings and conform to ISPF var */
/* rules (8 char or less) */
/*********************************************************************/
/* Change Log */
/* */
/* Author Date Reason */
/* -------- --------- ----------------------------------------- */
/* R. Zenuk Jul 2009 Initial Creation */
/* */
/*********************************************************************/
/* Replaceable character to handle double quotes inside a field */
/*********************************************************************/
repchar = '``'
/*********************************************************************/
/* Read input CSV records */
/*********************************************************************/
"EXECIO * DISKR CSVIN (STEM CSVIN. FINIS"
say csvin.0 'records'
/*********************************************************************/
/* Assume record 1 is the header record with column headings */
/*********************************************************************/
vars = strip(translate(translate(csvin.1,'_',' '),' ',','),'B','_')
outline.1 = csvin.1
varcount = words(vars)
say varcount 'variables'
/*********************************************************************/
/* Create a temporary ISPF table */
/*********************************************************************/
address ISPEXEC "TBCREATE CSV NAMES("varlist") REPLACE"
TBCRC = RC
if TBCRC <> 0 then say 'TBCREATE error RC='TBCRC
/* Store value into var for TBADD */
/*********************************************************************/
call value var,value
/*********************************************************************/
/* Stem the value for EXECIO */
/*********************************************************************/
call value var'.'i,value
outline.i = outline.i value
end
outline.i = strip(chgstr(outline.i,'"',repchar))
/*********************************************************************/
/* TBADD the row */
/*********************************************************************/
address ISPEXEC "TBADD CSV"
TBARC = RC
if TBARC <> 0 then say 'TBADD error RC='TBARC
end
/*********************************************************************/
/* Write the output file */
/*********************************************************************/
"EXECIO * DISKW OUTLINE (STEM OUTLINE. FINIS"
/*********************************************************************/
/* TBEND the CSV table */
/*********************************************************************/
address ISPEXEC "TBEND CSV"
TBERC = RC
if TBERC <> 0 then say 'TBEND error RC='TBERC
/*********************************************************************/
/* Print a summary of the variables */
/*********************************************************************/
do v=1 to varcount
var = word(vars,v)
say words(uniq.var) 'unique values for variable' var
end
exit 0
/*********************************************************************/
/* Change strings (works like translate) */
/*********************************************************************/
chgstr: procedure
parse arg string, new, old
lnew = length(new)
lold = length(old)
x = 1
do forever
if pos(old,string,x) = 0 then return string
x = pos(old,string,x)
string = insert(new,delstr(string,x,lold),x-1,lnew)
x = x + length(new)
end

Here is some JCL:

//jobcard...
//CSV2TAB EXEC PGM=IKJEFT01,PARM='ISPSTART CMD(%CSV2TAB)'
//SYSEXEC DD DSN=MY.EXEC,DISP=SHR
//ISPPLIB DD DSN=SYS1.ISPPLIB,DISP=SHR
//ISPSLIB DD DSN=SYS1.ISPSLIB,DISP=SHR
//ISPMLIB DD DSN=SYS1.ISPMLIB,DISP=SHR
//ISPTLIB DD DDNAME=ISPTABL
// DD DSN=SYS1.ISPTLIB,DISP=SHR
//ISPTABL DD LIKE=SYS1.ISPTLIB,UNIT=VIO,DSORG=PO
//ISPPROF DD LIKE=SYS1.ISPTLIB,UNIT=VIO,DSORG=PO
//ISPLOG DD SYSOUT=*,RECFM=VA,LRECL=125
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//CSVIN DD DSN=MY.INPUT.CSV,DISP=SHR
//OUTLINE DD SYSOUT=*

Rob
ONE ¦TWO ¦THREE¦FOUR ¦FIVE ¦SIX ¦SEVEN ¦EIGHT¦NINE ¦TEN
UN ¦DEUX¦TROIS¦QUATRE ¦CINQ ¦SIX ¦SEPT ¦HUIT ¦NEUF ¦DIX
UNO ¦DOS ¦TRES ¦CUATRO ¦CINCO ¦SEIS ¦SIETE ¦OCHO ¦NUEVE¦DIEZ
UNO ¦DUE ¦TRE ¦QUATTRO¦CINQUE¦SEI ¦SETTE ¦OTTO ¦NOVE ¦DIECI
EIENS¦ZWEI¦DREI ¦VIER ¦FüNF ¦SECHS¦SIEBEN¦ACHT ¦NEUN ¦ZEHN
JEDNA¦DVA ¦TRI ¦CTYRI ¦PET ¦SEST ¦SEDM ¦OSM ¦DEVET¦DESET
Såvida annat inte anges ovan: / Unless stated otherwise above:

Martin Dunkel

unread,
Feb 6, 2015, 1:10:17 PM2/6/15
to
Thank you all for the quick responses. I won't get a chance to try any of
these out until next week. But, now I have a lot to pick from. Before I
posted, when I started looking at my data more closely, I quickly realized
that my original, simple plan wasn't going to work:

drop v.
parse var recin v.1 ,
',' v.2 ,
',' v.3 ,
.

Bummer!

Martin Dunkel
Change and Release Management Analyst
Change & Release Management

PNC Financial - Enterprise Computing Services
4100 West 150th Street (Locator: B7-YB17-02-1)
Cleveland, OH 44135

(ph) 216.257.5354 | (c) 440.822.8178 | (fx) 216.257.8997
martin...@pnc.com



The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to read it. If you think you received it in error, please notify the sender. Do not forward or copy without permission of the sender. This message may be considered a commercial electronic message under Canadian law or this message may contain an advertisement of a product or service and thus may constitute a commercial electronic mail message under US law. You may unsubscribe at any time from receiving commercial electronic messages from PNC at http://pages.e.pnc.com/globalunsub/
PNC, 249 Fifth Avenue, Pittsburgh, PA 15222; pnc.com



Steve Coalbran

unread,
Feb 9, 2015, 4:23:55 AM2/9/15
to
I am trying to hide the message: "SE16661.PLEX0000.SPFLOG1 was
preallocated (no free was done)."
I have tried many things including DUMMYing out just about any likely
SYSOUT files, although if they are Permalc-d this won't have worked?
Any ideas? :-D
FYI: I am working on MOPZT01 (IBM Demopkg machine in Montpellier) using
Logon Proc ADTUSER.


Såvida annat inte anges ovan: / Unless stated otherwise above:
IBM Svenska AB
Organisationsnummer: 556026-6883
Adress: 164 92 Stockholm

Lizette Koehler

unread,
Feb 9, 2015, 8:46:42 AM2/9/15
to
Have you tried doing an OUTTRAP before you do the allocation?

Lizette

Steve Coalbran

unread,
Feb 9, 2015, 8:51:53 AM2/9/15
to
Hi Lizettem

Oh yes!
CALL OUTTRAP "O.,,CONCAT"
CALL MSG "OFF"
ALLOC DD(SYSxxxxx) DUMMY REUSE " for everything I can see gets allocated
to TERMIN

The trouble is that the LOGON PROC allocates the ISPLIG & ISPLIST datasets
in JCL as DISP=MOD.
The message comes from withinISPF
/Steve




From: Lizette Koehler <star...@MINDSPRING.COM>
To: TSO-...@VM.MARIST.EDU,
Date: 2015-02-09 14:47
Subject: Re: [TSO-REXX] ISPF Log file preallocation
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>



Lizette Koehler

unread,
Feb 9, 2015, 8:58:49 AM2/9/15
to
Please post your REXX. There might be a way around it, but not knowing how
your code is setup - it is difficult to determine

Styles, Andy , SD EP zPlatform

unread,
Feb 9, 2015, 9:03:48 AM2/9/15
to
Also that message will have a message id - TSO PROF MSGID?

Possibly unlikely to be useful, but you never know..


-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Lizette Koehler
Sent: 09 February 2015 13:59
To: TSO-...@VM.MARIST.EDU
Subject: Re: [TSO-REXX] ISPF Log file preallocation

-- This email has reached the Bank via an external source --
Lloyds Banking Group plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland no. SC95000. Telephone: 0131 225 4555. Lloyds Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales no. 2065. Telephone 0207626 1500. Bank of Scotland plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland no. SC327000. Telephone: 08457 21 31 41. Cheltenham & Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales 2299428. Telephone: 0845 603 1637

Lloyds Bank plc, Bank of Scotland plc are authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and Prudential Regulation Authority.

Cheltenham & Gloucester plc is authorised and regulated by the Financial Conduct Authority.

Halifax is a division of Bank of Scotland plc. Cheltenham & Gloucester Savings is a division of Lloyds Bank plc.

HBOS plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland no. SC218813.

This e-mail (including any attachments) is private and confidential and may contain privileged material. If you have received this e-mail in error, please notify the sender and delete it (including any attachments) immediately. You must not copy, distribute, disclose or use any of the information in it or any attachments. Telephone calls may be monitored or recorded.

Steve Coalbran

unread,
Feb 9, 2015, 9:11:20 AM2/9/15
to
Some fancy footwork omitted but basically this is it at the moment ...

(CSVENV) is called from LOGON menu Command
/*REXX*/ TRACE "O"
"CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
PUSH "CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
"ISPSTART CMD(ENVLOGO CSVLOGO) "
"CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
"ISPSTART PANEL(ISRÖPRIM) "
PULL .
/* ISPCLEAR is assembled and linked from Doug Nadel's sample that I stole
from a FORUM!
No standard CLRSCRN module here! Anywhere!! */

(ENVLOGO) above, displays a 'LOGO' screen
/*REXX*/ TRACE "O"
ARG panel
IF( panel="" )THEN PULL panel
IF( panel="" )THEN EXIT
sw = SYSVAR(SYSWTERM)-4
sl = SYSVAR(SYSLTERM)-4
ADDRESS ISPEXEC
"CONTROL ERRORS RETURN "
"CONTROL NONDISPL ENTER "
"DISPLAY PANEL(ISRÖPRIM) "
"ADDPOP ROW("sl-14") COLUMN(-99) "
"DISPLAY PANEL("panel") "
"REMPOP "

(CSVLOGO) is a 'logo' screen
)ATTR DEFAULT(%+_)
_ TYPE(INPUT) INTENS(NON) HILITE(BLINK)
$ TYPE(TEXT) COLOR(GREEN)
Ü TYPE(TEXT) COLOR(GREEN) HILITE(USCORE)
½ TYPE(TEXT) COLOR(RED)
)BODY WINDOW(32,14)
½ CCCCCCC SSSSSSS VV VV
½CCCCCCCCC SSSSSSSSS VV VV
½CC SS VV VV
½CC SS VV VV
½CC SSSSSSSS VV VV
½CC SSSSSSSS VV VV
½CC SS VVV VVV
½CC SS VVV VVV
½CCCCCCCCC SSSSSSSSS VVVVV
½ CCCCCCC SSSSSSS VVV
$
$ CSV Testing Environment
$ $has been allocated
$ PressÜANY$key to continue_ZCMD
)INIT
.CURSOR = ZCMD
.CSRPOS = 4
)END

Steve Coalbran

unread,
Feb 9, 2015, 9:15:41 AM2/9/15
to
Sorry Andy, it doesn't.
I added a PROF MSGID in several places!
No joy!

Pedro Vera

unread,
Feb 9, 2015, 9:27:26 AM2/9/15
to
Do you have more info about the allocation? What is the DD name? What is
the message id? If it is from the logon proc, what is the actual DD
statement you use?



Pedro Vera
DB2 Admin Tool
http://www-01.ibm.com/software/data/db2imstools/db2tools/db2admin/

Steve Coalbran

unread,
Feb 9, 2015, 9:47:01 AM2/9/15
to
Hi Pedro

> Do you have more info about the allocation?
Run with a TRACE "R" on the execs ...

READY
111 *-* "CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
>>> "CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
112 *-* PUSH "CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
>>> "CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
113 *-* "PROFILE MSGID NOWTPMSG "
>>> "PROFILE MSGID NOWTPMSG "
114 *-* "ISPSTART CMD(ENVLOGO CSVLOGO) "
>>> "ISPSTART CMD(ENVLOGO CSVLOGO) "
2 *-* ARG panel
>>> "CSVLOGO"
3 *-* IF( panel="" )
>>> "0"
4 *-* IF( panel="" )
>>> "0"
5 *-* sw = SYSVAR(SYSWTERM)-4
>>> "76"
6 *-* sl = SYSVAR(SYSLTERM)-4
>>> "39"
7 *-* ADDRESS ISPEXEC
8 *-* "CONTROL ERRORS RETURN "
>>> "CONTROL ERRORS RETURN "
9 *-* "CONTROL NONDISPL ENTER "
>>> "CONTROL NONDISPL ENTER "
10 *-* "DISPLAY PANEL(ISRÖPRIM) "
>>> "DISPLAY PANEL(ISRÖPRIM) "
11 *-* "ADDPOP ROW("sl-14") COLUMN(-99) "
>>> "ADDPOP ROW(25) COLUMN(-99) "
12 *-* "DISPLAY PANEL("panel") "
>>> "DISPLAY PANEL(CSVLOGO) "
-----------------------------------------------------
Menu Utilities Compilers Options Status Help

ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

ISPF Primary Option Menu
Option ===>

0 Settings Terminal and user parameters User ID . :
SE16661
1 View Display source data or listings Time. . . :
15:39
2 Edit Create or change source data Terminal. : 3278

3 Utilities Perform utility functions Screen. . : 1
4 Foreground Interactive language processing Language. :
ENGLISH
5 Batch Submit job for language processing Appl ID . : ISP

6 Command Enter TSO or Workstation commands TSO logon :
ADTUSER
7 Dialog Test Perform dialog testing TSO prefix:
SE16661
9 IBM Products IBM program development products System ID : ZT01

10 SCLM SW Configuration Library Manager MVS acct. :
SYS0000
11 Workplace ISPF Object/Action Workplace Release . : ISPF
7.1
12 z/OS System z/OS system programmer applications
13 z/OS User z/OS user applications

Enter X to Terminate using log/list defaults






EsssssssssssssssssssssssssssssssssN
e CCCCCCC SSSSSSS VV VV e
e CCCCCCCCC SSSSSSSSS VV VV e
e CC SS VV VV e
e CC SS VV VV e
e CC SSSSSSSS VV VV e
e CC SSSSSSSS VV VV e
e CC SS VVV VVV e
e CC SS VVV VVV e
e CCCCCCCCC SSSSSSSSS VVVVV e
e CCCCCCC SSSSSSS VVV e
e e
e CSV Testing Environment e
e has been allocated e
e Press ANY key to continue e
DsssssssssssssssssssssssssssssssssM
*CSVLOGO
-----------------------------------------------------
13 *-* "REMPOP "
>>> "REMPOP "
14 *-* ADDRESS TSO "PROFILE MSGID NOWTPMSG "
>>> "PROFILE MSGID NOWTPMSG "
SE16661.PLEX0000.SPFLOG1 was preallocated (no free was done).
115 *-* "CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
>>> "CALL 'SE16661.USER.LOAD(ISPCLEAR)' "
116 *-* "PROFILE MSGID NOWTPMSG "
>>> "PROFILE MSGID NOWTPMSG "
117 *-* "ISPSTART PANEL(ISRÖPRIM) "
>>> "ISPSTART PANEL(ISRÖPRIM) "
-----------------------------------------------------
Menu Utilities Compilers Options Status Help

ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss

ISPF Primary Option Menu
Option ===>

0 Settings Terminal and user parameters User ID . :
SE16661
1 View Display source data or listings Time. . . :
15:42
2 Edit Create or change source data Terminal. : 3278

3 Utilities Perform utility functions Screen. . : 1
4 Foreground Interactive language processing Language. :
ENGLISH
5 Batch Submit job for language processing Appl ID . : ISP

6 Command Enter TSO or Workstation commands TSO logon :
ADTUSER
7 Dialog Test Perform dialog testing TSO prefix:
SE16661
9 IBM Products IBM program development products System ID : ZT01

10 SCLM SW Configuration Library Manager MVS acct. :
SYS0000
11 Workplace ISPF Object/Action Workplace Release . : ISPF
7.1
12 z/OS System z/OS system programmer applications
13 z/OS User z/OS user applications

Enter X to Terminate using log/list defaults














EssssssssssssssssssssssssssssssssssssssssssssssN
e Licensed Materials - Property of IBM e
e 5650-ZOS Copyright IBM Corp. 1980, 2013. e
e US Government Users Restricted Rights - e
e Use, duplication or disclosure restricted e
e by GSA ADP Schedule Contract with IBM Corp. e
DssssssssssssssssssssssssssssssssssssssssssssssM

*ISRÖPRI
-----------------------------------------------------

> What is the DD name?
DDname of what?

> What is the message id?
Despite having PROF MSGID at many points, I get no MSGID

> If it is from the logon proc, what is the actual DD statement you use?
Started from the LOGON screen as...
Command ===> EX 'SE16661.USER.EXEC(CSVENV)'





From: Pedro Vera <pe...@us.ibm.com>
To: TSO-...@VM.MARIST.EDU,
Date: 2015-02-09 15:27
Subject: Re: [TSO-REXX] ISPF Log file preallocation
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>



Såvida annat inte anges ovan: / Unless stated otherwise above:
IBM Svenska AB
Organisationsnummer: 556026-6883
Adress: 164 92 Stockholm

Robert

unread,
Feb 9, 2015, 10:15:14 AM2/9/15
to
Easy-peasy.

Bracket whatever statement is generating the message with:
_MSG_STATE = MSG('Off'); /* Turn messaging off, save current message state
in _MSG_STATE */
<your existing code>
Call MSG _MSG_STATE; /* Restore previous messaging state */

Robert

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of
Steve Coalbran
Sent: Monday, February 9, 2015 3:24 AM
To: TSO-...@VM.MARIST.EDU

Steve Coalbran

unread,
Feb 9, 2015, 10:19:15 AM2/9/15
to
Sorry Robert,
This is not related to the problem. I don't care what state MSG is I just
want it *OFF* ;-D
/Steve



From: Robert <rob...@GARRETTFAMILY.US>
To: TSO-...@VM.MARIST.EDU,
Date: 2015-02-09 16:15
Subject: Re: [TSO-REXX] ISPF Log file preallocation
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>



Easy-peasy.

Bracket whatever statement is generating the message with:
_MSG_STATE = MSG('Off'); /* Turn messaging off, save current message
state
in _MSG_STATE */
<your existing code>
Call MSG _MSG_STATE; /* Restore previous messaging state */

Robert

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of
Steve Coalbran
Sent: Monday, February 9, 2015 3:24 AM
To: TSO-...@VM.MARIST.EDU
Subject: [TSO-REXX] ISPF Log file preallocation

Ken MacKenzie

unread,
Feb 9, 2015, 10:27:30 AM2/9/15
to
Do you need the log? I usually go to SETTINGS (main menu option 0) and
select LOG/LIST defaults and then select Log Data set defaults.

Set the primary pages and secondary pages to zero - nothing gets logged.
Does that help?


Ken MacKenzie
Pramerica Systems Ireland Limited
is a private company limited by shares
incorporated and registered in the Republic of Ireland with registered
number 319900
and registered office at 6th Floor, South Bank House, Barrow Street,
Dublin 4, Ireland.




From: Steve Coalbran <COA...@SE.IBM.COM>
To: TSO-...@VM.MARIST.EDU,
Date: 09/02/2015 09:24
Subject: [TSO-REXX] ISPF Log file preallocation
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>



Robert

unread,
Feb 9, 2015, 10:28:21 AM2/9/15
to
Ok, so you don't care about the messaging state. Then no need to restore
it.
Did you actually TRY it?

If something you're doing (an "ALLOC", a "FREE", a "SYSDSN" call for
example) in your existing code is generating that message, then setting the
state to "Off" beforehand *WILL* suppress it.

Mickey

unread,
Feb 9, 2015, 10:31:10 AM2/9/15
to
X = MSG('OFF')
do some stuff
do some more stuff
X = MSG('ON')

Baldon, David

unread,
Feb 9, 2015, 10:32:58 AM2/9/15
to
Is the "real" issue that you're seeing the " SE16661.PLEX0000.SPFLOG1 was preallocated (no free was done)." message after the display of the CSVLOGO panel and the display of the ISR@PRIM panel? If so, I believe the problem is the two ISPSTARTs in the CSVENV EXEC. When the first ISPSTART "completes" it is destroying the ISPF environment at which point the log data set is "processed" resulting in the message. I suspect you also see the "no free was done" message again after exiting the ISR@PRIM panel. Is that correct?

Maybe you could free the DD's before doing the ISPSTART? If ISPF has not been started the data set(s) should not be open so you should be able to free them.

...David

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Steve Coalbran
Sent: Monday, February 09, 2015 8:47 AM
To: TSO-...@VM.MARIST.EDU

Steve Coalbran

unread,
Feb 10, 2015, 12:06:46 AM2/10/15
to
Hi Ken,
I do not need the log here for this first ISPSTART which is simply a
mini-session just to allow me to display a pseudo-'LOGO' informing which
environment is currently active.
The second it could be good to have the log although I don't remember the
last time I ever referenced one!
Whatever, I want to do this within the dialog. Perhaps I need to study the
LOG/LIST panel and see which variables it uses and save-then-alter them
and restore later.
/Steve



From: Ken MacKenzie <Ken.Ma...@PRAMERICA.IE>
To: TSO-...@VM.MARIST.EDU,
Date: 2015-02-09 16:28
Subject: Re: [TSO-REXX] ISPF Log file preallocation
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>



Do you need the log? I usually go to SETTINGS (main menu option 0) and
select LOG/LIST defaults and then select Log Data set defaults.

Set the primary pages and secondary pages to zero - nothing gets logged.
Does that help?


-- deleted history ---

Steve Coalbran

unread,
Feb 10, 2015, 1:44:49 AM2/10/15
to
Hi David,

Yes, it was just that pesky message I was trying to avoid, or rather the
*** prompt following it.
I have commuted the message tp "SE16661.SPFLOG6.LIST has been kept." now
but I still get the *** prompt!

Nothing I have tried seems to work.
I think I'll just have to accept it!!!
It's only a minor irritation I guess.

/Steve



From: "Baldon, David" <David_...@BMC.COM>
To: TSO-...@VM.MARIST.EDU,
Date: 2015-02-09 16:33
Subject: Re: [TSO-REXX] ISPF Log file preallocation
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>



Is the "real" issue that you're seeing the " SE16661.PLEX0000.SPFLOG1 was
preallocated (no free was done)." message after the display of the CSVLOGO
panel and the display of the ISR@PRIM panel? If so, I believe the problem
is the two ISPSTARTs in the CSVENV EXEC. When the first ISPSTART
"completes" it is destroying the ISPF environment at which point the log
data set is "processed" resulting in the message. I suspect you also see
the "no free was done" message again after exiting the ISR@PRIM panel. Is
that correct?

Maybe you could free the DD's before doing the ISPSTART? If ISPF has not
been started the data set(s) should not be open so you should be able to
free them.

...David

-----Original Message-----
Deleted

Robin Ryerse

unread,
Feb 10, 2015, 8:09:34 AM2/10/15
to
You are getting close to the solution. I have not read all the responses so
maybe someone has already suggested that what you need is a pre-allocated,
offline ISPPROF dataset wherein ISPF is set not to LOG its session.


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

Baldon, David

unread,
Feb 10, 2015, 8:50:43 AM2/10/15
to
Do you have access to ISR@PRIM or can you make a copy of it in your own panel library? If so, this should work.
1) Update your copy of ISR@PRIM and add a "hidden" option like this; EL,'CMD(ENVLOGO)'
2) Update CSVENV and update the ISPSTART command to include this parameter; "opt(el)" and then remove the second ISPSTART. The OPT parameter allows you to specify an option that will be "selected" without user interaction.

This is a simplified version of what I do in my logon process so it is untested.

...David

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Steve Coalbran
Sent: Tuesday, February 10, 2015 12:42 AM
To: TSO-...@VM.MARIST.EDU
Subject: Re: ISPF Log file preallocation

Steve Coalbran

unread,
Feb 10, 2015, 10:13:21 AM2/10/15
to
Thanks Robin,

If I could ISPSTART the first CMD with a NEWAPPL and in this set a PROFILE
variable (?names/clues?) to NO/0/NOLOG (whatever) then I would be
delighted. :-D

Having scoured my ISPF 7.3 for some time, I see nothing remotely like
this.
Where are these secrets kept...

...and I have read through Peter van Dyke's SHARE presentation on "ISPF
Hidden Treasures and New Features" several times.
I may be getting on but I don't believe I missed this reference, unless
the FIND function in PDF Adobe Reader did!? :-/

/Steve

Lizette Koehler

unread,
Feb 10, 2015, 10:25:31 AM2/10/15
to
Can you create your own ISRCONFG member? You could customize it to suppress
LOG/LIST functions. I think it needs to live in the LINKLST.
http://www-01.ibm.com/support/knowledgecenter/SSLTBW_1.12.0/com.ibm.zos.r12.
f54pc00/confuti.htm%23confuti

http://tinyurl.com/kxyzog7



Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On
> Behalf Of Steve Coalbran
> Sent: Tuesday, February 10, 2015 8:12 AM
> To: TSO-...@VM.MARIST.EDU
> Subject: Re: [TSO-REXX] ISPF Log file preallocation
>

Paul Gilmartin

unread,
Feb 10, 2015, 10:55:17 AM2/10/15
to
On 2015-02-09, at 23:42, Steve Coalbran wrote:
>
> Yes, it was just that pesky message I was trying to avoid, or rather the
> *** prompt following it.
> I have commuted the message tp "SE16661.SPFLOG6.LIST has been kept." now
> but I still get the *** prompt!
>
For me, twice. On my TSO login panel I have a startup EXEC that
launches ISPF. I must answer the "***" prompt once, presumably
when TSO transfers control to the EXEC. I must answer the "***"
prompt again, presumably when the EXEC starts ISPF. That's two
too many.

But my EXEC contains a couple SAYs. Maybe I should try removing
those.

-- gil

Baldon, David

unread,
Feb 10, 2015, 11:29:41 AM2/10/15
to
This worked for me but there are times I need the log so...

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Ken MacKenzie
Sent: Monday, February 09, 2015 9:27 AM
To: TSO-...@VM.MARIST.EDU

Steve Coalbran

unread,
Feb 11, 2015, 2:06:37 AM2/11/15
to
Thanks David.

That works! :-D

As you say sometimes (if, in my case, rarely) one needs the LOG but I
guess it's just to reset the ZLOG1PGP & ZLOG2PGP variables?
I tried doing this inside the ENVLOG dialogue and VPUTting to everywhere
like this...
PARSE VALUE 3 0 0 0 0 WITH zlogclap zlog1pg zlog2pg zlog1pgp zlog2pgp
"VPUT (ZLOGCLAP ZLOG1PG ZLOG2PG ZLOG1PGP ZLOG2PGP) PROFILE "
"VPUT (ZLOGCLAP ZLOG1PG ZLOG2PG ZLOG1PGP ZLOG2PGP) SHARED "
"VPUT (ZLOGCLAP ZLOG1PG ZLOG2PG ZLOG1PGP ZLOG2PGP) "
...but this is completely ignored! :-(

/Steve



From: "Baldon, David" <David_...@BMC.COM>
To: TSO-...@VM.MARIST.EDU,

Baldon, David

unread,
Feb 11, 2015, 8:04:01 AM2/11/15
to
The thanks belong to Ken. I just confirmed his suggested solution.

Since the log is allocated as part of the ISPF startup process, once you set the variables and VPUT them (only PROFILE is needed), you'll have to exit ISPF at which time the original values will be used. Then, start ISPF again and the new values should be used meaning no log data set will be allocated or opened.

...David

Steve Coalbran

unread,
Feb 11, 2015, 8:57:45 AM2/11/15
to
Thanks David.

Sadly VPUT won't work as they aren't stored in the profile member ISPPROF
but in ISPSPROF.
I tried it... zip!

I see the variables: ZLOGFDSP, ZLOG1PGP & ZLOG2PGP set in ISPSPROF.
I did try adding an NEWAPPL(ISPS) but can't fool ISPF!...
ISPD133 Invalid application ID
Appl ID 'ISPS' is reserved for system use by the dialog manager.
Bummer? ¦-(

I think I will have to proceed with my table services jiggery-pokery on
ISPSPROF.
It's getting there.
Whether it is worth all this effort to bypass one little prompt I am not
sure?! :-/

Moyeen Khan

unread,
Feb 12, 2015, 7:17:57 PM2/12/15
to
On Thursday, February 5, 2015 at 12:45:39 PM UTC-5, Martin Dunkel wrote:
> Does anyone have a subroutine or function built to parse csv data???
>
> It looks like my data is basically separated by commas:
> field1,field2,field3
>
> However...
>
> If the field contains a comma or multiple commas then the whole field is
> contained within double quotes:
> field1,"a,b,c",field3
>
> If the field contains a double quote, then this is represented by two
> double quotes:
> field1,"a b "" c d",field3
>
> If the field contains a single quote then nothing special is done:
> field1,field2',field3
>
> And, obviously, if there is no data in a field, you get:
> field1,,field3
>
> There are 40 fields in each record, and 2,635 records in the file I am
> working with, so it's not a huge file.
>
> By the way, SAS handles this pretty nicely with:
> DATA MMS;
> INFILE MMSIN DLM='6B'X DSD LRECL=6000 TRUNCOVER;
>
> INPUT V1 :$8.
> V2 :$8.
> V3 :$80.
> ;
>
> I am just looking for a Rexx solution.
>
> Thanks! MPD
>
> Martin Dunkel
> Change and Release Management Analyst
> Change & Release Management
>
> PNC Financial - Enterprise Computing Services
> 4100 West 150th Street (Locator: B7-YB17-02-1)
> Cleveland, OH 44135
>
> (ph) 216.257.5354 | (c) 440.822.8178 | (fx) 216.257.8997
> martin...@pnc.com
>
>
>
> The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to read it. If you think you received it in error, please notify the sender. Do not forward or copy without permission of the sender. This message may be considered a commercial electronic message under Canadian law or this message may contain an advertisement of a product or service and thus may constitute a commercial electronic mail message under US law. You may unsubscribe at any time from receiving commercial electronic messages from PNC at http://pages.e.pnc.com/globalunsub/
> PNC, 249 Fifth Avenue, Pittsburgh, PA 15222; pnc.com
>
>
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions,
> send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Another way of doing this


/* Rexx */

Allocate Input File
Allocate Output File

For all records
Read Input Record into xInData
Call Csv2Dsn
Write output record from xoutData
Loop


Exit

Csv2Dsn:

/* Define Your Fields Here - Length and Justification */
xFld. ='20 L' /* Default Length and Justification */
xFld.1='10 L'
xFld.2='15 L'
xFld.3='7 R'
xFld.4='6 L'

/* Constants */
cDq='""'
cSq='"'
cComa=','
cUS="_"
cBs="\"
cAt='@'
cR='R'
cZero=0
cSpace=' '

/* Convert Double Quotes to another Symbol */
xInData=Translate(xInData,cUs,cSpace)
nPos=Pos(cDq,xInData)
Do While nPos>0
Parse Var xInData xPart1 (cDq) xPart2
xInData=xPart1||cAt||xPart2
nPos=Pos(cDq,xInData)
End

/* Convert Data in Single Quotes */
nPos=Pos(cSq,xInData)
Do While nPos>0
Parse Var xInData xPart1 (cSq) xPart2 (cSq) xPart3
xPart2=Translate(xPart2,cBs,cComa)
xInData=xPart1||xPart2||xPart3
nPos=Pos(cSq,xInData)
End
xInData=Translate(xInData,cSpace,cComa)

/* Build the new Data */

xOutData=cSpace
Do I=1 By 1 Until I=Words(xInData)
mWord=Word(xInData,I)
mWord=Translate(mWord,cComa||cSpace||cSq,cBs||cUs||cAt)
Parse Var xFld.I nLen xJust .
If xJust=cR Then mWord=Right(mWord,nLen,cZero)
Else mWord=Left(mWord,nLen)
xOutData=xOutData||mWord
End
0 new messages