IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to identify records with spaces in between numbers


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prafull

New User


Joined: 08 Dec 2006
Posts: 48

PostPosted: Sat Nov 17, 2007 2:51 pm
Reply with quote

We have a file which has 10 byte aphanumeric field AT POSITION 1-10

Our requirement is to find the records which have spaces in between numbers.
e.g.
The input file has records like
(also see attached image )

Code:
*1234      *
*56 78     *
*456  567  *
*456    127*
*45     127*
*4       27*
*   4567   *
*  4567    *
*  45678910*
*   567 910*

record# 2 3 4 5 6 and 10 are having space(s) between numbers.
We have to catch these kinda records... Is it possible using DFOSRT ?
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Sat Nov 17, 2007 6:23 pm
Reply with quote

prafull,
Please check with the following code for your requirement.
Code:
// EXEC PGM=SORT                                                 
//SORTIN DD *                                                   
1234                                                             
56 78                                                           
456  567                                                         
456    127                                                       
45     127                                                       
4       27                                                       
   4567                                                         
  4567                                                           
  45678910                                                       
   567 910                                                       
//SORTOUT DD SYSOUT=*                                           
//SYSOUT DD SYSOUT=*                                             
//SYSIN DD *                                                     
 OPTION COPY                                                     
 INREC IFTHEN=(WHEN=(1,1,SS,EQ,C'0123456789'),OVERLAY=(81:C'1'),
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(1,1,CH,EQ,C' '),OVERLAY=(81:C'0'),                 
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(2,1,SS,EQ,C'0123456789'),OVERLAY=(82:C'1'),       
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(2,1,CH,EQ,C' '),OVERLAY=(82:C'0'),                 
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(3,1,SS,EQ,C'0123456789'),OVERLAY=(83:C'1'),       
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(3,1,CH,EQ,C' '),OVERLAY=(83:C'0'),                 
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(4,1,SS,EQ,C'0123456789'),OVERLAY=(84:C'1'),       
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(4,1,CH,EQ,C' '),OVERLAY=(84:C'0'),                 
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(5,1,SS,EQ,C'0123456789'),OVERLAY=(85:C'1'),       
 HIT=NEXT),                                                       
 IFTHEN=(WHEN=(5,1,CH,EQ,C' '),OVERLAY=(85:C'0'),                 
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(6,1,SS,EQ,C'0123456789'),OVERLAY=(86:C'1'),   
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(6,1,CH,EQ,C' '),OVERLAY=(86:C'0'),           
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(7,1,SS,EQ,C'0123456789'),OVERLAY=(87:C'1'),   
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(7,1,CH,EQ,C' '),OVERLAY=(87:C'0'),           
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(8,1,SS,EQ,C'0123456789'),OVERLAY=(88:C'1'),   
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(8,1,CH,EQ,C' '),OVERLAY=(88:C'0'),           
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(9,1,SS,EQ,C'0123456789'),OVERLAY=(89:C'1'),   
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(9,1,CH,EQ,C' '),OVERLAY=(89:C'0'),           
 HIT=NEXT),                                                 
 IFTHEN=(WHEN=(10,1,SS,EQ,C'0123456789'),OVERLAY=(90:C'1'), 
 HIT=NEXT),                                                   
 IFTHEN=(WHEN=(10,1,CH,EQ,C' '),OVERLAY=(90:C'0'))           
 OUTFIL INCLUDE=(81,10,SS,EQ,C'101',OR,                       
                 81,10,SS,EQ,C'1001',OR,                     
                 81,10,SS,EQ,C'10001',OR,                     
                 81,10,SS,EQ,C'100001',OR,                   
                 81,10,SS,EQ,C'1000001',OR,                   
                 81,10,SS,EQ,C'10000001',OR,                 
                 81,10,SS,EQ,C'100000001',OR,                 
                 81,10,SS,EQ,C'1000000001',OR,               
                 81,10,SS,EQ,C'10000000001',OR,               
                 81,10,SS,EQ,C'100000000001'),               
         OUTREC=(1,80)                                       
/*                                                           
//                                                           

Output:
Code:
56 78           
456  567       
456    127     
45     127     
4       27     
   567 910     
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 17, 2007 9:03 pm
Reply with quote

Prafull,

Here's a simpler way to do what you want using DFSORT's PARSE function:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1234
56 78
456  567
456    127
45     127
4       27
   4567
  4567
  45678910
   567 910
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC PARSE=(%=(STARTAT=NONBLANK,ENDBEFR=C' '),
               %1=(STARTAT=NONBLANK,FIXLEN=1)),
        OVERLAY=(81:%1)
  OUTFIL INCLUDE=(81,1,CH,NE,C' '),
     BUILD=(1,80)
/*


I assumed you only have blanks after position 10 as shown in your example. If you have nonblanks after position 10, I can show you how to adjust the job to handle that.
Back to top
View user's profile Send private message
prafull

New User


Joined: 08 Dec 2006
Posts: 48

PostPosted: Sun Nov 18, 2007 10:57 pm
Reply with quote

Gr8! thanks lot both of you...
Yes Frank ,actually we have non-blanks after 10 bytes icon_sad.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Nov 19, 2007 10:16 pm
Reply with quote

Quote:
Yes Frank ,actually we have non-blanks after 10 bytes


In that case, you can use a DFSORT job like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
1234        R01   
56 78       R02   
456  567    R03   
456    127  R04   
45     127  R05   
4       27  R06   
   4567     R07   
  4567      R08   
  45678910  R09   
   567 910  R10   
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:1,10)),
    IFTHEN=(WHEN=INIT,
      PARSE=(%=(ABSPOS=81,STARTAT=NONBLANK,ENDBEFR=C' '),
               %1=(STARTAT=NONBLANK,FIXLEN=1)),
        OVERLAY=(81:%1))
  OUTFIL INCLUDE=(81,1,CH,NE,C' '),
     BUILD=(1,80)
/*
Back to top
View user's profile Send private message
sarbamrit

New User


Joined: 15 Oct 2007
Posts: 12
Location: Kentucky

PostPosted: Wed Nov 21, 2007 9:25 am
Reply with quote

I'm not sure whether this is possible using DFSORT
If we divide the first 10 byte by any number say 5 or 10 and if we get a numeric values that means it doesnt have any space in between else it will have a space.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 21, 2007 10:10 pm
Reply with quote

Amrit,

Your suggestion doesn't really make any sense. What format (ZD, FS, ?)do you think you could use for the 10-byte field that would give a non-numeric value when divided by 5? What exactly would you expect as a non-numeric value? Think it through and try to come up with an actual workable solution based on your idea and I believe you'll find you can't.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts How to identify the transaction categ... IMS DB/DC 3
Search our Forums:

Back to Top