Page 1 of 1

Using OUTREC in a VB file with records of different lengths

PostPosted: Thu Jan 14, 2010 9:11 pm
by clint
Hi

I am stuck trying to edit and rebuild a VB file.
This file comprises an array of 23 possible occurences per record.
In other words the minimum length of a record is 217 and the maximum is 5178.
In the sort I am blanking several alphanumeric fields as well as initializing several packed fields.
I am keeping the same length and structure of each record.

When I execute the sort I am getting an error of WER244A - short outrec.

Is it at all possible to run such a simple sort on a file that contains records of various lengths or am I just wasting my time. Is there a setting or parameter that allows the sort to ignore those records that aren't as long as the others?

Clint

Re: Using OUTREC in a VB file with records of different lengths

PostPosted: Thu Jan 14, 2010 9:23 pm
by Alissa Margulies
You can try coding OUTREC BUILD=(1,4,5)

If this does not give you the desired output, then please show me your original control cards.

Re: Using OUTREC in a VB file with records of different lengths

PostPosted: Sun Jan 17, 2010 1:52 pm
by clint
This is what I am sending:

//SORTIN DD DSN=TST.PT.HKDOAR.ELECTRON.A0501.MASLUL2,DISP=SHR
//SORTOUT DD DSN=TST.PT.HKDOAR.ELECTRON.A0501.MASLUL2.CLEAN,
// SPACE=(27998,(1600,500),RLSE),DISP=(,CATLG),
// DCB=(BLKSIZE=27998,LRECL=12254,RECFM=VB),
// UNIT=DASD
//SYSOUT DD SYSOUT=R,CHARS=GS10
//SYSPRINT DD SYSOUT=R,CHARS=GS10
//SYSUDUMP DD SYSOUT=D,CHARS=GS10
//SYSIN DD *
SORT FIELDS=(7,2,BI,A)
OUTREC BUILD=(1,4,5,16,X'0000000C',25,2,X'00000C',X,31,124,X'000C',
X'000C',159,20,23X,202,18,X,221,1,23X,245,18,X,264,1,
23X,288,18,X,307,1,23X,331,18,X,350,1,23X,374,18,X,
393,1)
END

This is what I am receiving after I run the JCL:
SYSDIAG= 120530, 490300, 490300, 2525775
24,608K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
16K BYTES RESERVE REQUESTED, 24,560K BYTES USED
16K BYTES OF EMERGENCY SPACE ALLOCATED
SORTIN : RECFM=VB ; LRECL= 5178; BLKSIZE= 11000
OUTREC RECORD LENGTH = 393
SORTOUT : RECFM=VB ; LRECL= 12254; BLKSIZE= 27998
OUTPUT LRECL DIFFERS FROM SORTOUT LRECL
23,580K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
0 BYTES RESERVE REQUESTED, 23,580K BYTES USED
G=2292,B=56656,BIAS=80
0 PREALLOCATED SORTWORK TRACKS, 150 DYNAMICALLY ALLOCATED,
0 ACQUIRED IN SECONDARY EXTENTS, 0 RELEASED, TOTAL OF 7 TRACKS USED
END SORT PHASE
OUTREC - SHORT RECORD
SYNCSMF CALLED BY SYNCSORT; RC=0000

Re: Using OUTREC in a VB file with records of different lengths

PostPosted: Thu Jan 28, 2010 3:58 am
by Alissa Margulies
Hello Clint.

The job below will create a "PROFILE" for variable-length records - the output file will display how many times each "different" record length occurs.

As you probably know, all variable-length records start with a 4-byte RDW (record descriptor word). And the length of each individual record is contained in the first 2 bytes of that RDW.

For this process, the INREC control statement is used to do the following:

1. Copy the entire 4-byte RDW
2. Re-Copy the first 2 bytes of the RDW
3. Insert a counter that has a value of “1”

Note: The entire 4-byte RDW must be coded into the INREC and the OUTREC control statements.
Additionally, the length portion of the RDW must be copied, independently, a second time.
//S1    EXEC PGM=SORT
//SYSOUT  DD SYSOUT=*
//SORTIN  DD DSN=INPUT.FILE,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN   DD *
   INREC FIELDS=(1,4,1,2,1C'0000001') 
   SORT FIELDS=(5,2,CH,A)                             
   SUM FIELDS=(7,7,ZD)   
   OUTREC FIELDS=(01:1,4,
                05:5,2,BI,EDIT=(TTTTT),
                11:7,7,ZD,EDIT=(T,TTT,TTT))
/*

Sample Output Data Set:
00100 0,100,023 
00151 0,098,490 
00208 0,203,341 
00252 0,010,607 
00275 0,033,811 
00388 1,056,077 
00545 0,109,579
 

The first column displays different lengths that exist.
The second column displays how many records of this length exist in your file.

Now use this information and compare this to the OUTREC Control Statement that you have coded in your original application.
Determine what you want to do with the short records.
To eliminate these records, you may use the following "OMIT COND" in your existing application:

OMIT COND=(1,2,BI,LT,X'0187')

Re: Using OUTREC in a VB file with records of different lengths

PostPosted: Thu Jan 28, 2010 9:17 pm
by clint
Thanks for the profile.

I tried running it but got incomplete results.

I have approximately 846 records in this input file and the profile I got back was the following:

00221 0,000,079
00264 0,000,004
00307 0,000,000
00350 0,000,000
00393 0,000,000

The figures don't add up. I checked that I have one record which is 393 long.

That is one issue. The other issue is how do I use this profile if I want to actually edit the fields of each of the records?
I don't need to omit any records. On the contrary, I expect to receive an output file with the same number of records as the input but where several of the fields have been modified. Once again, we are talking about an input file which has a fixed portion of 175 characters and then a portion which comprises a potential 43 occurences of 23 characters.

I really appreciate the help as it will speed up the testing process of the new system I am developing.

Re: Using OUTREC in a VB file with records of different lengths

PostPosted: Thu Jan 28, 2010 10:00 pm
by Alissa Margulies
I found a typo in the OUTREC statement of the profile step, which I corrected. That should work now. However, that may not even be necessary...

In regards to modifying fields, you cannot code an OUTREC BUILD statement which includes a field that does not exist in the record. Here is a SORT job that should give you the desired results:
//S1    EXEC PGM=SORT
//SYSOUT  DD SYSOUT=*
//SORTIN  DD DSN=TST.PT.HKDOAR.ELECTRON.A0501.MASLUL2,DISP=SHR
//SORTOUT DD DISP=(NEW,PASS),DSN=&&TEMP1
//SYSIN   DD *
  SORT FIELDS=COPY
  OUTREC BUILD=(5,389),CONVERT,VLFILL=(X'40')
/*
//S2    EXEC PGM=SORT
//SYSOUT  DD SYSOUT=*
//SORTIN  DD DISP=SHR,DSN=&&TEMP1
//SORTOUT DD DSN=TST.PT.HKDOAR.ELECTRON.A0501.MASLUL2.CLEAN,...
//SYSIN   DD *
  SORT FIELDS=(3,2,BI,A)
  OUTREC BUILD=(1,16,X'0000000C',21,2,X'00000C',X,27,124,X'000C',
  X'000C',155,20,23X,198,18,X,217,1,23X,241,18,X,260,1,
  23X,284,18,X,303,1,23X,327,18,X,346,1,23X,370,18,X,389,1),
  FTOV,VLTRIM=(X'40')
/*

Give that a try and let me know if you encounter any further difficulties.