Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to identify records with spaces in between numbers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to identify records with spaces in between numbers
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    Post subject:
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 Moderator


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

PostPosted: Sat Nov 17, 2007 9:03 pm    Post subject:
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    Post subject: Reply to: How to identify records with spaces in between num
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 Moderator


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

PostPosted: Mon Nov 19, 2007 10:16 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed Nov 21, 2007 10:10 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Could we identify the called modules ... elixir1986 COBOL Programming 5 Fri Jul 14, 2017 1:53 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us