Hi Kolusu, I think I messed up my original note by trying to keep the
characters in order.

I have attached a file that shows my JCL with input and output expected.
The current run, though has a problem with the Parse for %02 and %03. I
hope you can help me with this - it is probably simple.

Thanks!
B

On Fri, Apr 21, 2017 at 2:05 PM, Sri h Kolusu <skol...@us.ibm.com> wrote:

> Bill,
>
> Why bother about the position. From the looks of it, you need to pick the
> last qualifier. So go find the last byte space and then subtract 12 bytes
> to get to your dataset name.
>
> something like this
>
> //STEP0100 EXEC PGM=SORT
> //SYSOUT   DD SYSOUT=*
> //SORTIN   DD *
> EZA2284I`-RW-R--R--```1`FTPUSER``FTPUSERS```42160`SEP``2``2016`TESTFL1.BIN
>
> EZA2284I`-RW-R--R--```1`FTPUSER``FTPUSERS``442160`NOV`10`15:26`TEST2.TXT
> //SORTOUT  DD SYSOUT=*
> //SYSIN    DD *
>   OPTION COPY
>   INREC IFTHEN=(WHEN=INIT,
>          PARSE=(%=(ENDBEFR=C' '),
>                 %01=(SUBPOS=12,FIXLEN=12)),
>          BUILD=(%01)),
>
>         IFTHEN=(WHEN=(1,12,SS,EQ,C'`'),
>          PARSE=(%02=(STARTAFT=C'`',FIXLEN=12)),
>          BUILD=(%02))
>
>   OUTREC BUILD=(1,12,SQZ=(SHIFT=LEFT,LENGTH=80,
>                          LEAD=C' get  /thisdirectory/',
>                          TRAIL=C' //DD:LIST'))
> //*
>
>
> The outout from this job is
>
>  get  /thisdirectory/TESTFL1.BIN //DD:LIST
>  get  /thisdirectory/TEST2.TXT //DD:LIST
>
>
> Further if you have any questions please let me know
>
>
> Thanks,
> Kolusu
> DFSORT Development
> IBM Corporation
>
>
>
> From:   Bill Ashton <bill00ash...@gmail.com>
> To:     IBM-MAIN@LISTSERV.UA.EDU
> Date:   04/21/2017 10:47 AM
> Subject:        How to parse rows using SORT
> Sent by:        IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU>
>
>
>
> Hello friends!
>
> I just ran into a problem, and am a bit confused how to correct this.
>
> I am reading the output of an FTP list command, and using SORT to capture
> and format the FTP GET commands I need. This process is working fine for
> the most part, and it produces the correct commands most of the time.
> However, I just noticed that the file list is different in one of my
> folders, causing me to lose the first character of the filename.
>
> I had been using this:
> PARSE=(%02=(ABSPOS=65,ENDBEFR=C'.',FIXLEN=8),
>        %03=(FIXLEN=3)),
>
> but now I find that one of my folders starts the file name in pos 64, and
> not 65.
>
> Is there a way to not use ABSPOS=65, but instead to say I want to start
> following a space after Col 60? In Rexx, I could say to use the 10th word,
> but I don't want to change the SORT to Rexx now, as this input is doing a
> number of different things.
>
> Here is a sample of the file listing (with ` replacing blanks to keep
> spacing intact):
>
> EZA2284I`-rw-r--r--```1`ftpuser``ftpusers```42160`Sep``2``2016`TESTFL1.BIN
> EZA2284I`-rw-r--r--```1`ftpuser``ftpusers``442160`Nov`10`15:26`TEST2.TXT
>
> My output from the Sort is going to say
> get  /thisdirectory/TESTFL1.BIN  //DD:LIST
> get  /thisdirectory/TEST2.TXT    //DD:LIST
>
> Thanks for your help with this troublesome question!
>
> --
> Thank you and best regards,
> *Billy Ashton*
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
>
>
>
>
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>



-- 
Thank you and best regards,
*Billy Ashton*

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
//SORTCOPY EXEC PGM=SORT                                                     
//SYSOUT   DD SYSOUT=*                                                       
//SORTIN   DD *                                                              
EZA1460I Command:                                                            
EZA1736I bin                                                                 
EZA1701I >>> TYPE I                                                          
200 Type okay.                                                               
EZA1460I Command:                                                            
EZA1736I CD  /sys01/new2017/input                                            
EZA1701I >>> CWD /sys01/new2017/input                                        
250 "/sys01/new2017/input" is new cwd.                                       
EZA1460I Command:                                                            
EZA1736I dir                                                                 
EZA1701I >>> TYPE A                                                          
200 Type okay.                                                               
EZA1701I >>> PORT 141,233,65,11,185,248                                      
200 PORT command successful.                                                 
EZA1701I >>> LIST                                                            
150 Opening ASCII mode data connection for /bin/ls.                          
EZA2284I -RW-R--R--   1 ftpuser  ftpusers    42160 Sep  2  2016 TESTFL1.BIN  
EZA2284I -RW-R--R--   1 ftpuser  ftpusers   442160 Nov 10 15:26 TEST2.TXT    
226 Listing completed.                                                       
EZA1701I >>> TYPE I                                                          
200 Type okay.                                                               
EZA1460I Command:                                                            
EZA1736I CD  /sys12/y2017/processed                                          
EZA1701I >>> CWD /sys12/y2017/processed                                      
250 "/sys12/y2017/processed" is new cwd.                                     
EZA1460I Command:                                                            
EZA1736I dir                                                                 
EZA1701I >>> TYPE A                                                          
200 Type okay.                                                               
EZA1701I >>> PORT 141,233,65,11,185,254                                      
200 PORT command successful.                                                 
EZA1701I >>> LIST                                                            
150 Opening ASCII mode data connection for /bin/ls.                          
EZA2284I -rw-r--r--   1 ftpuser  ftpusers  145120 Dec 29 10:23 HOLDDATA.BIN  
EZA2284I -rw-r--r--   1 ftpuser  ftpusers   32080 Apr  3 12:28 REPORT1.TXT   
EZA2284I -rw-r--r--   1 ftpuser  ftpusers  408160 Nov 15 11:33 NEWDATA.BIN   
226 Listing completed.                                                       
EZA1701I >>> TYPE I                                                          
200 Type okay.                                                               
EZA1460I Command:                                                            
EZA1736I QUIT generated by unexpected end of file                            
EZA1701I >>> QUIT                                                            
221 Goodbye.                                                                 
/*                                                                           
//SORTOUT  DD SYSOUT=*                                            
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INCLUDE COND=(1,003,CH,EQ,C'250',OR,                            
                1,100,SS,EQ,C'.BIN ')                             
                                                                  
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'250'),                          
      PARSE=(%01=(STARTAFT=C'"',ENDBEFR=C'"',FIXLEN=50)),         
      BUILD=(%01)),                                               
  IFTHEN=(WHEN=NONE,                                              
      PARSE=(%02=(STARTAT=C'.BIN',SUBPOS=10,ENDBEFR=C' '),          
             %03=(STARTAFT=C' ',ENDAT=C'.BIN')),                  
      BUILD=(51:C'/',%03))                                        
                                                                  
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,GT,C' '),PUSH=(1,50)),  
  IFTHEN=(WHEN=INIT,                                              
  BUILD=(01:1,64,SQZ=(SHIFT=LEFT,LEAD=C'get  ',LENGTH=64),        
         65:C'//DD:LIST')                                         
                                                                  
  OUTFIL OMIT=(65,1,CH,EQ,C' '),                                  
  BUILD=(1,124,SQZ=(SHIFT=LEFT,MID=C'  ',LENGTH=80))              
/*                                                                
//*                                                               
//                                                                

Should produce output like:
get  /sys01/new2017/input/TESTFL1.BIN    //DD:LIST  
get  /sys12/y2017/processed/OLDDATA.BIN  //DD:LIST
get  /sys12/y2017/processed/NEWDATA.BIN  //DD:LIST 

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

Reply via email to