Re: Fixed fields in regex (was: Trying to Parse a LISTCAT with SORT)

2022-10-26 Thread Walt Farrell
On Tue, 25 Oct 2022 10:33:23 -0500, Paul Gilmartin  wrote:

>On Tue, 25 Oct 2022 08:55:09 -0500, Walt Farrell wrote:

>On Sat, 22 Oct 2022 04:09:43 +, Sri h Kolusu  wrote:
>>  %03=(ENDBEFR=C'.',FIXLEN=8),   # Node 3
>> ...
>Thanks.  I've wished for something line FIXLEN in regular expressions.

Got an example of what you want in regular expressions?

>>>NONVSAM --- MYFILE.ABLA.MIDDLE.N04.REPT3.NOTUSE
>>> DATASET-OWNER-(NULL) CREATION2022.200
>>>
>>>becomes:
>>>N04  REPT320220719 MIDDLE  
>>
>>Sorry; doesn't help. I should have been more specific, and started with "what 
>>does FIXLEN do that you'd want to see in a regular expression?"
>>
>
>
>See the ply cited where Sri h Kolusu addressed the OP's requirement.  Could 
>this have been
>done in awk or sed with regular expressions?  In REXX I used LEFT() to achieve 
>the function.

Thanks for the doc reference.

So FIXLEN is applying to the output rather than the input. I don't think there 
are functions like that in standard regular expression processing, since it's 
about input parsing, not creation of output records. I have no idea if sed or 
awk have any specific functions like that for formatting their output, as I 
selecom use them. 
Sorry.

-- 
Walt

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Fixed fields in regex (was: Trying to Parse a LISTCAT with SORT)

2022-10-25 Thread Paul Gilmartin
On Tue, 25 Oct 2022 08:55:09 -0500, Walt Farrell wrote:
>>>
On Sat, 22 Oct 2022 04:09:43 +, Sri h Kolusu  wrote:
>  %03=(ENDBEFR=C'.',FIXLEN=8),   # Node 3
> ...
Thanks.  I've wished for something line FIXLEN in regular expressions.
>>>
>>>Got an example of what you want in regular expressions?
>>>
>>NONVSAM --- MYFILE.ABLA.MIDDLE.N04.REPT3.NOTUSE
>> DATASET-OWNER-(NULL) CREATION2022.200
>>
>>becomes:
>>N04  REPT320220719 MIDDLE  
>
>Sorry; doesn't help. I should have been more specific, and started with "what 
>does FIXLEN do that you'd want to see in a regular expression?"
>


See the ply cited where Sri h Kolusu addressed the OP's requirement.  Could 
this have been
done in awk or sed with regular expressions?  In REXX I used LEFT() to achieve 
the function.

-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Fixed fields in regex (was: Trying to Parse a LISTCAT with SORT)

2022-10-25 Thread Walt Farrell
On Sun, 23 Oct 2022 09:36:49 -0500, Paul Gilmartin  wrote:

>On Sun, 23 Oct 2022 08:59:09 -0500, Walt Farrell wrote:
>>
>>>On Sat, 22 Oct 2022 04:09:43 +, Sri h Kolusu  wrote:
  %03=(ENDBEFR=C'.',FIXLEN=8),   # Node 3
 ...
>>>Thanks.  I've wished for something line FIXLEN in regular expressions.
>>
>>Got an example of what you want in regular expressions?
>>
>NONVSAM --- MYFILE.ABLA.MIDDLE.N04.REPT3.NOTUSE
> DATASET-OWNER-(NULL) CREATION2022.200
>
>becomes:
>N04  REPT320220719 MIDDLE  

Sorry; doesn't help. I should have been more specific, and started with "what 
does FIXLEN do that you'd want to see in a regular expression?"

-- 
Walt

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Fixed fields in regex (was: Trying to Parse a LISTCAT with SORT)

2022-10-23 Thread Paul Gilmartin
On Sun, 23 Oct 2022 08:59:09 -0500, Walt Farrell wrote:
>
>>On Sat, 22 Oct 2022 04:09:43 +, Sri h Kolusu  wrote:
>>>  %03=(ENDBEFR=C'.',FIXLEN=8),   # Node 3
>>> ...
>>Thanks.  I've wished for something line FIXLEN in regular expressions.
>
>Got an example of what you want in regular expressions?
>
NONVSAM --- MYFILE.ABLA.MIDDLE.N04.REPT3.NOTUSE
 DATASET-OWNER-(NULL) CREATION2022.200

becomes:
N04  REPT320220719 MIDDLE  

>(Possibly best to start a separate thread/topic, though :) )
>
(Continued thread; changed Subject:)

-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Trying to Parse a LISTCAT with SORT

2022-10-23 Thread Walt Farrell
On Sat, 22 Oct 2022 10:03:49 -0500, Paul Gilmartin  wrote:

>On Sat, 22 Oct 2022 04:09:43 +, Sri h Kolusu  wrote:
>>...
>>  %03=(ENDBEFR=C'.',FIXLEN=8),   # Node 3
>> ...
>Thanks.  I've wished for something line FIXLEN in regular expressions.

Got an example of what you want in regular expressions?

(Possibly best to start a separate thread/topic, though :) )

-- 
Walt

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Trying to Parse a LISTCAT with SORT

2022-10-22 Thread Sri h Kolusu
>> But:  With  decimal point? without decimal point?

Gil,

DFSORT can process with or without the decimal point. Using the format UFF we 
strip off the decimal point.  UFF (unsigned free form numeric) format extracts 
decimal digits (0-9) from right to left anywhere in the field to form a 
positive number. Any
combination of characters is valid, but characters other than 0-9 are ignored.  
So, I first removed the decimal point using 58,08,UFF,M11,LENGTH=7,  and then 
converted the date to Gregorian format

>> 4-digit year? 2-digit year?

DFSORT can convert both 4 digit and 2 digit years. Here is the table which 
shows the TOJUL and TOGREG output date fields

https://www.ibm.com/docs/en/zos/2.5.0?topic=statements-outfil-control#oufcst__tatodf

>> Sliding window centered on current year?

DFSORT prints a message ICE168I about the sliding window when processing the 2 
digit years.

https://www.ibm.com/docs/en/zos/2.5.0?topic=messages-ice168i

We also provide a runtime option to override it called Y2PAST which can set the 
sliding year

https://www.ibm.com/docs/en/zos/2.5.0?topic=ssc-example-6


Thanks,
Kolusu

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Trying to Parse a LISTCAT with SORT

2022-10-22 Thread Paul Gilmartin
On Sat, 22 Oct 2022 04:09:43 +, Sri h Kolusu  wrote:
>...
>  %03=(ENDBEFR=C'.',FIXLEN=8),   # Node 3
> ...
Thanks.  I've wished for something line FIXLEN in regular expressions.


On Sat, 22 Oct 2022 04:17:59 +, Sri h Kolusu wrote:
>...
>It is quite simple to convert the Julian date to Gregorian date using DFSORT.
>All you need is another IFHTEN statement to process the julian date
>
>IFTHEN=(WHEN=(42,10,CH,EQ,C'CREATION--'),
> OVERLAY=(165:58,08,UFF,M11,LENGTH=7,
>  175:165,07,Y4T,TOGREG=Y4T))
>
But:
With  decimal point?
without decimal point?
4-digit year?
2-digit year?
Sliding window centered on current year?

So: 
(It's fairly unbiased -- almost everyone doesn't use it.)

-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Trying to Parse a LISTCAT with SORT

2022-10-21 Thread Sri h Kolusu
>Am I reasonably close? (I don't think so...) Bonus points would be given to 
>convert the date from .DDD to MMDD!

Gil,

It is quite simple to convert the Julian date to Gregorian date using DFSORT.

All you need is another IFHTEN statement to process the julian date

IFTHEN=(WHEN=(42,10,CH,EQ,C'CREATION--'),
 OVERLAY=(165:58,08,UFF,M11,LENGTH=7,
  175:165,07,Y4T,TOGREG=Y4T))


Thanks,
Kolusu
DFSORT Development
IBM Corporation



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Trying to Parse a LISTCAT with SORT

2022-10-21 Thread Sri h Kolusu
>>. I am trying to use SORT to process a LISTCAT to give me part of the DSN and 
>>the creation date

Don,

Use the following Untested DFSORT control cards which will give you the desired 
results.

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DISP=SHR,DSN=Your Input Listcat VBA 137 byte file
//SORTOUT  DD SYSOUT=*
//SYSINDD *
  OPTION COPY,VLSCMP
  INREC IFTHEN=(WHEN=(06,07,CH,EQ,C'NONVSAM'),
   PARSE=(%=(ENDBEFR=C'.',
  ABSPOS=21),# Node 1
  %=(ENDBEFR=C'.'),  # Node 2
  %03=(ENDBEFR=C'.',FIXLEN=8),   # Node 3
  %04=(ENDBEFR=C'.',FIXLEN=8),   # Node 4
  %05=(ENDBEFR=C'.',FIXLEN=8)),  # Node 5
 OVERLAY=(138:%03,
  %04,
  %05))

  OUTREC IFTHEN=(WHEN=GROUP,
BEGIN=(06,07,CH,EQ,C'NONVSAM'),
 PUSH=(138:138,24))

  OUTFIL VTOF,
  INCLUDE=(42,10,CH,EQ,C'CREATION--'),
  BUILD=(146,08,X,
 154,08,X,
 058,08,X,
 138,08,X)
/*

Thanks,
Kolusu
DFSORT Development
IBM Corporation



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: Trying to Parse a LISTCAT with SORT

2022-10-21 Thread Doug
Message me off line and I will share what works best for what we need.
No pretty enough to post here but gets what I need for info 
Best Regards 
Doug


.

On Oct 21, 2022, at 19:31, Paul Gilmartin 
<042bfe9c879d-dmarc-requ...@listserv.ua.edu> wrote:

On Fri, 21 Oct 2022 16:22:56 -0500, Don Johnson  wrote:

> Hello! I just tried to post a question with embedded code and fixed 
> formatting, but it was rejected because HTML is not supported.
> 
I tried a HTTP attachment.  LISTSERV ignored it.

> Am I reasonably close? (I don't think so...) Bonus points would be given to 
> convert the date from .DDD to MMDD!
> 
With desktop Regina (ANSI Rexx):
#! /bin/sh

# Test data:
echo "\
NONVSAM --- MYFILE.ABLA.LONGNODE.NODE004.VARNODE1.NOTUSE
 DATASET-OWNER-(NULL) CREATION2018.341
NONVSAM --- MYFILE.ABLA.SHORT.NODE4.RPT2.NOTUSE
 DATASET-OWNER-(NULL) CREATION2015.113
NONVSAM --- MYFILE.ABLA.MIDDLE.N04.REPT3.NOTUSE
 DATASET-OWNER-(NULL) CREATION2022.200
NONVSAM --- MYFILE.ABLA.SHORT.NODE04.RR.NOTUSE
 DATASET-OWNER-(NULL) CREATION2021.026 " |

rexx /dev/fd/3 3<

Re: Trying to Parse a LISTCAT with SORT

2022-10-21 Thread Paul Gilmartin
On Fri, 21 Oct 2022 16:22:56 -0500, Don Johnson  wrote:

>Hello! I just tried to post a question with embedded code and fixed 
>formatting, but it was rejected because HTML is not supported.
> 
I tried a HTTP attachment.  LISTSERV ignored it.

>Am I reasonably close? (I don't think so...) Bonus points would be given to 
>convert the date from .DDD to MMDD!
> 
With desktop Regina (ANSI Rexx):
#! /bin/sh

# Test data:
echo "\
NONVSAM --- MYFILE.ABLA.LONGNODE.NODE004.VARNODE1.NOTUSE
  DATASET-OWNER-(NULL) CREATION2018.341
NONVSAM --- MYFILE.ABLA.SHORT.NODE4.RPT2.NOTUSE
  DATASET-OWNER-(NULL) CREATION2015.113
NONVSAM --- MYFILE.ABLA.MIDDLE.N04.REPT3.NOTUSE
  DATASET-OWNER-(NULL) CREATION2022.200
NONVSAM --- MYFILE.ABLA.SHORT.NODE04.RR.NOTUSE
  DATASET-OWNER-(NULL) CREATION2021.026 " |

rexx /dev/fd/3 3<

Re: Trying to Parse a LISTCAT with SORT

2022-10-21 Thread Paul Gilmartin
On Fri, 21 Oct 2022 16:22:56 -0500, Don Johnson  
wrote:

>Hello! I just tried to post a question with embedded code and fixed 
>formatting, but it was rejected because HTML is not supported.
>
???
It's supposed to be supported.  Posting from the website, I'll try to attach  
some
HTML.

>So I will post it in plain text, and you can cut/paste into notepad or 3270 to 
>see how it lines up. If there is a way to use code blocks here, please let me 
>know and I won't do this to you again!
> 
???
Just do it!  I view from the LISTSERV website and choose
"Options:   Use Monospaced Font" and it looks fine.  Is your MUA defaulting
to a proportional font?

(more later).

-- 
gil



--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Trying to Parse a LISTCAT with SORT

2022-10-21 Thread Don Johnson
Hello! I just tried to post a question with embedded code and fixed formatting, 
but it was rejected because HTML is not supported.

So I will post it in plain text, and you can cut/paste into notepad or 3270 to 
see how it lines up. If there is a way to use code blocks here, please let me 
know and I won't do this to you again!

Don

Here is the original note...

Hello there. I am trying to use SORT to process a LISTCAT to give me part of 
the DSN and the creation date. I would normally use Rexx for something like 
this, but have over 10 filenames I am working on, and thought this might be 
easier - except I can't get it to work. Part of the problem is that the LISTC 
output is a VBA 137 file, and I have not worked much with VB files. Another 
problem is that the data I want is on two different lines. I can strip the file 
down to these two lines, but can't seem to pull off the individual nodes. Here 
is a sample of how my input file looks for those two lines (without the RDW).

+1+2+3+4+5+6-
NONVSAM --- MYFILE.ABLA.LONGNODE.NODE004.VARNODE1.NOTUSE
   DATASET-OWNER-(NULL) CREATION2018.341
NONVSAM --- MYFILE.ABLA.SHORT.NODE4.RPT2.NOTUSE
   DATASET-OWNER-(NULL) CREATION2015.113
NONVSAM --- MYFILE.ABLA.MIDDLE.N04.REPT3.NOTUSE
   DATASET-OWNER-(NULL) CREATION2022.200
NONVSAM --- MYFILE.ABLA.SHORT.NODE04.RR.NOTUSE
   DATASET-OWNER-(NULL) CREATION2021.026 

The fields in color are the ones I want to have, and as you can see the purple 
(3rd), red (4th), and green (5th) nodes are variable length.

The output should be one line per file, like this:

+1+2+3+4
NODE004  VARNODE1 2018.341 LONGNODE 
NODE4RPT2 2015.113 SHORT
N04  REPT32022.200 MIDDLE   
NODE04   RR   2021.026 SHORT

Here is my mess of code, which gives errors about RDW and just doesn't work.

  OPTION COPY,VLSCMP   
  INCLUDE COND=(001,60,SS,EQ,C'NONVSAM ---',OR,
001,60,SS,EQ,C'CREATION')  
  INREC IFOUTLEN=140,  
 IFTHEN=(WHEN=(06,9,CH,EQ,C'NONVSAM -'),   
  PARSE=(%01=(STARTAFT=C'ABLA.',ENDBEFR=C'.',FIXLEN=8), # NODE3
 %02=(STARTAFT=C'.',ENDBEFR=C'.',FIXLEN=8), # NODE4
 %03=(STARTAFT=C'.',ENDBEFR=C'.',FIXLEN=8))),   # NODE5
 IFTHEN=(WHEN=(42,9,CH,EQ,C'CREATION-'),   
  PARSE=(%04=(STARTAFT=C'',ENDBEFR=BLANKS,FIXLEN=8)), #DATE
  BUILD=(%02,X,
 %03,X,
 %04,X,
 %01,  
 80:X))   # BLANK FILL 
  OUTFIL VTOF,INCLUDE=(35,40,SS,EQ,C'CREATION') 
/* 

Am I reasonably close? (I don't think so...) Bonus points would be given to 
convert the date from .DDD to MMDD!

Thanks for your help!

Don

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN