Re: How to SORT Variable records with OVERLAY

2022-12-13 Thread Billy Ashton
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:

//SYSINDD *
  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 OrderDocument  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 OrderDocument
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" 

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.

Re: How to SORT Variable records with OVERLAY

2022-12-12 Thread Sri h Kolusu
>> 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


How to SORT Variable records with OVERLAY

2022-12-12 Thread Billy Ashton
Hi all, I am taking a file and using PUSH and OVERLAY to condense 
multiple input lines into a single line. That all works fine and I even 
get the correct format output when I use OPTION COPY or SORT 
FIELDS=COPY.


However, I want to sort on my OVERLAY area fields, but I get an error 
message
ICE218A 3 117 BYTE VARIABLE RECORD IS SHORTER THAN 138 BYTE MINIMUM FOR  
FIELDS


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


What do I need to do to use SORT FIELDS=(...) here? Do I need to just 
overlay the unneeded columns at the beginning of the record? All my sort 
keys will be shorter than the shortest record in the file, but I 
expected that by using INCLUDE statements to only keep the long records 
I needed, I would not run into this.


My control cards say
OPTION VLSCMP
SORT FIELDS=(set1,set2, set3)
INCLUDE COND=...,OR, ...
INREC with multiple IFTHEN and PUSH and OVERLAYs
OUTFIL VTOF, INCLUDE,BUILD

There must be something simple I am missing (and there will be another 
question tomorrow if I get this fixed).


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