Eliminate records with Specific value



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Eliminate records with Specific value

Postby rjambu » Tue Nov 01, 2011 9:34 pm

Hi,
Could any one give me a solution for the below .
I am trying to Eliminate records with specific value in its field 1 to 9 columns and store it in another file using JCL.

File formate of both input and output files are FB

Source File:

DSN=TEST.SRC.FILE1
LRECL=1200
RECFM=FB

i/p:
454450617|b10|Connecticut|...
111111111|A10|San joes|...
111111111|T89|columbus|...
908770617|S50|New york|...


Need to eliminate the records with 111111111 which is in the field 1 to 9 and store the o/p records to dataset TEST.TGT.FILE2
Expected o/p:
454450617|b10|Connecticut|...
908770617|S50|New york|...



Thanks,
JRS
rjambu
 
Posts: 27
Joined: Tue Feb 08, 2011 7:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Eliminate records with Specific value

 

Re: Eliminate records with Specific value

Postby dick scherrer » Tue Nov 01, 2011 9:53 pm

Hello,

Look in this forum for examples of OMIT.

All you need to do is COPY the data and OMIT the value(s) you do not want in the output.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Eliminate records with Specific value

Postby rjambu » Tue Nov 01, 2011 11:27 pm

Thanks Got the code from the previous post, works fine

question: Is it possible to get the eliminated records in a DataSet ?

Thanks,
JRS
rjambu
 
Posts: 27
Joined: Tue Feb 08, 2011 7:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Eliminate records with Specific value

Postby Frank Yaeger » Tue Nov 01, 2011 11:42 pm

Is it possible to get the eliminated records in a DataSet ?


You can use a DFSORT job like the following:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
454450617|B10|CONNECTICUT|...
111111111|A10|SAN JOES|...
111111111|T89|COLUMBUS|...
908770617|S50|NEW YORK|...
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTFIL FNAMES=OUT1,OMIT=(1,9,CH,EQ,C'111111111')
  OUTFIL FNAMES=OUT2,SAVE
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: Eliminate records with Specific value

Postby rjambu » Fri Nov 04, 2011 11:55 pm

Hi,
I tried the code with the the file struct below getting S1 - ABEND=S000 U0222

TEST.SRC.FILE
454450617NB10CONNECTICUT...
111111111YA10SAN JOES...   
111111111YT89COLUMBUS...   
908770617YS50NEW YORK...   


i am eliminating the records in the 10 th field having value 'N'
JCL looks like this

//S1 EXEC PGM=SORT                               
//SYSOUT DD SYSOUT=*                             
//OUT1   DD  DSN=TEST.TGT.FILE,             --  target dataset 
//           UNIT=DISK,SPACE=(TRK,(1,2),RLSE),   
//           DCB=(LRECL=1200,BLKSIZE=0,RECFM=FB),
//           DISP=(NEW,CATLG,DELETE)             
//OUT2   DD  DSN=TEST.TGT.FILE2,               --  target where the eliminated records is saved
//           UNIT=DISK,SPACE=(TRK,(1,2),RLSE),   
//           DCB=(LRECL=1200,BLKSIZE=0,RECFM=FB),
//           DISP=(NEW,CATLG,DELETE)             
//SORTIN DD TEST.SRC.FILE                     -- Source file
//OUT1 DD SYSOUT=*                               
//OUT2 DD SYSOUT=*                               
//SYSIN DD *                                     
  OPTION COPY                                     
  OUTFIL FNAMES=OUT1,OMIT=(10,1,CH,EQ,C'X')
  OUTFIL FNAMES=OUT2,SAVE                         
/*                                               
//


Please let me know if anything needs to be added ot removed?

Thanks,
JS
rjambu
 
Posts: 27
Joined: Tue Feb 08, 2011 7:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Eliminate records with Specific value

Postby dick scherrer » Sat Nov 05, 2011 12:09 am

Hello,

You need to post the diagnostic information generated by the run. Include the message ids.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Eliminate records with Specific value

Postby Akatsukami » Sat Nov 05, 2011 12:46 am

rjambu wrote:Hi,
I tried the code with the the file struct below getting S1 - ABEND=S000 U0222

How very unfortunate! If only it were the case that
•If ABEND or ABSTP is in effect and DFSORT terminates with an error message, you receive a user abend. With installation option ABCODE=MSG (the supplied default), the user abend code is equal to the error message (for example, U0046 for message ICE046A). With installation option ABCODE=n, the user abend code is equal to n (for example, U0010 with ABCODE=10 for any error message). For user abend codes that are error message numbers (ABCODE=MSG), you can refer to the explanation for the corresponding message (for example, the ICE046A Explanation for U0046).

Then you could read the fine manual and discover:
ICE222A

n BYTE FIXED RECORD LENGTH IS NOT EQUAL TO m BYTE LRECL FOR ddname

Explanation:

Critical. The LRECL specified or retrieved for the fixed-length OUTFIL data set was not equal to the computed length of the output records for that data set. You cannot use the LRECL value to pad the OUTFIL records or to truncate the records produced by BUILD, OUTREC, OVERLAY, FINDREP, IFTHEN BUILD, IFTHEN OVERLAY, IFTHEN FINDREP or IFTHEN PUSH operand processing. The values shown in the message are as follows:

• n is the computed length of the output records for the OUTFIL group
• m is the specified or retrieved LRECL of the OUTFIL data set
• ddname indicates the OUTFIL data set for which padding or truncation was required

System action:
The program terminates.

Programmer response:
Take one of these actions as appropriate:

• Do not set the LRECL explicitly. Instead, let DFSORT set the LRECL to the computed record length.
• If you are using IFTHEN operands, specify IFOUTLEN=m. (Remember to allow an extra byte for OUTFIL report data sets for the ANSI carriage control character unless you specify the REMOVECC operand.)
• If you are not using IFTHEN operands, ensure that the computed length for the BUILD, OVERLAY, or FINDREP operand, or the specified MAXLEN length for the FINDREP operand, is equal to m. (Remember to allow an extra byte for OUTFIL report data sets for the ANSI carriage control character unless you specify the REMOVECC operand.)
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Eliminate records with Specific value

Postby Frank Yaeger » Sat Nov 05, 2011 1:36 am

Source File:

DSN=TEST.SRC.FILE1
LRECL=1200
RECFM=FB


If the SORTIN data set has RECFM=FB and LRECL=1200 as you say in your first post, then the job would work fine and you'd get DFSORT messages like this:

...
ICE088I 0 JRS3    .S1      .        , INPUT LRECL = 1200, BLKSIZE = 27600, TYPE = FB
...
ICE210I 0 OUT1     : EXCP USED, LRECL = 1200, BLKSIZE = 27600, TYPE = FB   (SDB)
ICE210I 0 OUT2     : EXCP USED, LRECL = 1200, BLKSIZE = 27600, TYPE = FB   (SDB)
...
ICE054I 0 RECORDS - IN: 4, OUT: 4                                   
ICE227I 0 OUT1     : DELETED = 0, REPORT = 0, DATA = 4               
ICE228I 0 OUT1     : TOTAL IN = 4, TOTAL OUT = 4                     
ICE227I 0 OUT2     : DELETED = 4, REPORT = 0, DATA = 0               
ICE228I 0 OUT2     : TOTAL IN = 4, TOTAL OUT = 0                     


For your example input, all of the records would go to OUT1 since none of them have X in position 10.

Since you received the ICE222A message, it appears that you gave some bad information in your first post. You received a message like this:

ICE222A 0 1100 BYTE FIXED RECORD LENGTH IS NOT EQUAL TO 1200 BYTE LRECL FOR OUT1

The first value would be the LRECL of your input file and it does NOT match the 1200 byte LRECL for your output file.

Please give the correct RECFM and LRECL of your input file and expected output files.

Please show the complete JES log for your run.

Note that you have duplicate //OUT1 DDs - DFSORT will use the first one it finds. Same with your duplicate //OUT2 DDs.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post