Hi Kolusu...I have to toss in the white flag here, as I tried a few different things unsuccessfully. I have attached a groomed file of the input (it is the output of an IDCAMS Listcat for certain sales report files), and below is a second file for my second part of this. Here is what I am trying to get: 1. From the groomed File1 - a VBA 133 file of LISTCAT data - I am trying to get a list of the files and their created date, sorted in order of division, order number, and descending document creation date. 2. Then, I am trying to match that against the second file which has the latest processed document for each order to show two different reports: A. Any document that has not been processed for an order (1 to n records each), and
B. The most recent document that has not been processed (1 record only)

Here is my SORT for #1, which works great to copy, but does not work to sort:
//SYSIN    DD *
  OPTION VLSCMP,VLSHRT
  SORT FIELDS=COPY
* SORT FIELDS=(116,08,CH,A,124,03,CH,A,135,7,CH,D)
*
  INCLUDE COND=(06,07,CH,EQ,C'NONVSAM',OR,
                42,10,CH,EQ,C'CREATION--')
*
  INREC  IFOUTLEN=150,IFTHEN=(WHEN=GROUP,
                BEGIN=(06,07,CH,EQ,C'NONVSAM'),
                 PUSH=(69:22,44)),
         IFTHEN=(WHEN=(42,10,CH,EQ,C'CREATION--'),
              PARSE=(%=(ENDBEFR=C'.',ABSPOS=65),
                       %=(ENDBEFR=C'.'),
                       %01=(STARTAFT=C'SLDIV',        Division
                            ENDBEFR=C'.',FIXLEN=3),
                       %02=(ENDBEFR=C'.',FIXLEN=8),   Order Num
                       %03=(ENDBEFR=C'.',FIXLEN=8)),  Doc ID
              OVERLAY=(115:C'Y',
                       116:%03,
                       124:%01,
                       127:%02,
                       135:58,08,UFF,M11,LENGTH=7,
                       142:135,07,Y4T,TOGREG=Y4T,
                       150:X))
*
  OUTFIL VTOF,
  INCLUDE=(115,01,CH,EQ,C'Y'),
  BUILD=(124,03,X,          # Division
         116,08,X,          # Doc ID
         127,08,X,          # Order Num
         19X,               # Filler
         142,08,X,          # Cre Date Greg
         135,07,X)          # Cre Date Jul
/*

For #2, I am trying to create report #1 with a title "Current Order Documents/By Division and Document Type". There are no control breaks, just a list, showing any items from #1, above, in Ascending Division and Order, and Descending Document Createdate. Here is a sample:
Div Order    Document  Cre Date
120 $3B37368 DORDP001 20201204
120 @7415755 DPINS003 20201127
120 @7415755 DORDP001 20201129
120 @7415755 DPAYI022 20201204
120 @7415755 DXCHP3R4 20201220
136 $G855813 DORDC244 20210505
242 @Q405827 DPINS003 20200808
242 @Q405827 DPINB022 20200808
242 @Q405827 DORDPP22 20200812

Report #2 is called "Orders With All Documents Current" and is a reflection of orders with the most recent (file2) and latest document (file1) being the same. There is one record per order.
Div Order    Document
120 $3B37368 DORDP001
(120 @7415755 is not here bc file2 has DPAYI022, and file1 has a later DXCHP3R40 document)
136 $G855813 DORDC244
242 @Q405827 DREFC001

File1 is attached (the LISTCAT output)
File2 a FB 40 file with
120 $3B37368 DORDP001
120 @7415755 DPAYI022
136 $G855813 DORDC244
242 @Q405827 DREFC001
251 DM405862 DORDPP22
251 DM415866 DORDC244
251 DM423871 DINVP002
281 RB415889 DSPL1PR4
281 TA720006 DORDP042
281 TA916078 DPINM111
281 VJ124311 DRET1PR4
288 @@366084 DINVC011
288 @N416086 DRETW023
288 MM737722 DCRMV002

Kolusu, I appreciate whatever guidance you can give me here. I am sure I could write a program to do this two-file match, but I am trying to open eyes to the possibility of a faster-running SORT process.

Thank you and best regards,
Billy Ashton


------ Original Message ------
From "Sri h Kolusu" <skol...@us.ibm.com>
To IBM-MAIN@listserv.ua.edu
Date 12/12/2022 5:02:55 PM
Subject Re: How to SORT Variable records with OVERLAY

 Because my input is a VBA file (out of my control), some of the records are 
much shorter than my SORT FIELDS location.

Billy,

Ideally you can use VLSHRT for padding short records for SORTING. However, if 
you use INREC/OUTREC , it will not work.

So, if you want to use INREC editing you need to PUSH the contents right after 
RDW to retain the variable length records.  If you don't care about variable 
lengths of the output file then use IFOUTLEN= nnn  ( where nnn= max length of 
the overlay/push record).

Alternatively, if you show me the control cards I can show you the optimal way 
of achieving the results.

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

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
0NONVSAM ------- PRD.ORDERS.SLDIV120.$3B37368.DORDP001.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.339
0NONVSAM ------- prd.orders.sldiv1...@7415755.dpins003.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.332
0NONVSAM ------- prd.orders.sldiv1...@7415755.dordp001.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.334
0NONVSAM ------- prd.orders.sldiv1...@7415755.dpayi022.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.339
0NONVSAM ------- prd.orders.sldiv1...@7415755.dxchp3r4.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.355
0NONVSAM ------- PRD.ORDERS.SLDIV136.$G855813.DORDC244.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2021.125
0NONVSAM ------- prd.orders.sldiv2...@q405827.dpins003.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.221
0NONVSAM ------- prd.orders.sldiv2...@q405827.dpinb022.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.221
0NONVSAM ------- prd.orders.sldiv2...@q405827.dordpp22.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.225
0NONVSAM ------- prd.orders.sldiv2...@q405827.dpayc001.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.226
0NONVSAM ------- prd.orders.sldiv2...@q405827.dcrmc003.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.251
0NONVSAM ------- prd.orders.sldiv2...@q405827.drefc001.docm  
        DATASET-OWNER-----(NULL)     CREATION--------2020.254
0NONVSAM ------- PRD.ORDERS.SLDIV251.DM405862.DORDPP22.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.315
0NONVSAM ------- PRD.ORDERS.SLDIV251.DM415866.DORDC244.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.349
0NONVSAM ------- PRD.ORDERS.SLDIV251.DM423871.DORDC244.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2021.007
0NONVSAM ------- PRD.ORDERS.SLDIV251.DM423871.DINVP002.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2021.007
0NONVSAM ------- PRD.ORDERS.SLDIV251.DM423871.DPAYC001.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2021.007
0NONVSAM ------- PRD.ORDERS.SLDIV281.RB415889.DPINL433.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.352
0NONVSAM ------- PRD.ORDERS.SLDIV281.RB415889.DORDPB13.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.358
0NONVSAM ------- PRD.ORDERS.SLDIV281.RB415889.DPAYC001.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.358
0NONVSAM ------- PRD.ORDERS.SLDIV281.RB415889.DSPLX030.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.358
0NONVSAM ------- PRD.ORDERS.SLDIV281.RB415889.DSH21PR4.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.362
0NONVSAM ------- PRD.ORDERS.SLDIV281.TA720006.DORDP042.DOCM  
        DATASET-OWNER-----(NULL)     CREATION--------2020.364
0NONVSAM ------- PRD.ORDERS.SLDIV281.TA916078.DPINM111.DOCM   
        DATASET-OWNER-----(NULL)     CREATION--------2021.011 
0NONVSAM ------- PRD.ORDERS.SLDIV281.VJ124311.DRET1PR4.DOCM   
        DATASET-OWNER-----(NULL)     CREATION--------2021.011 
0NONVSAM ------- PRD.ORDERS.SLDIV288.@@366084.DINVC011.DOCM   
        DATASET-OWNER-----(NULL)     CREATION--------2021.006 
0NONVSAM ------- prd.orders.sldiv2...@n416086.dretw023.docm   
        DATASET-OWNER-----(NULL)     CREATION--------2021.010 
0NONVSAM ------- PRD.ORDERS.SLDIV288.MM737722.DCRMV002.DOCM   
        DATASET-OWNER-----(NULL)     CREATION--------2021.013 

----------------------------------------------------------------------
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