MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Numeric Check using SORT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Fri Feb 15, 2008 12:26 am    Post subject: Numeric Check using SORT Reply with quote

I have a FB file where in Positions 13 to 15 is a 3 bytes field which can carry either a numeric number or alphanumric values.

Here is a sample data
Code:

=COLS> ----+----1----+-
'''''' XXXXXXXXXXXXX09
'''''' YYYYYYYYYYYY100
'''''' ZZZZZZZZZZZZZZZ
'''''' AAAAAAAAAAAAA89
'''''' BBBBBBBBBBBB199
'''''' CCCCCCCCCCCCCCC

I would like to format the 3 bytes as per the following rule

If numeric keep as it is. if alphanumeric ( All bytes) replace with 777. If 13th byte is alone alphanumeric replace with Zero only if 14 and 15 bytes are Numeric.

* There can never be a situation where in 13 and 14 bytes will be alpha numeric and 15th byte is Numeric

As per tha above example for the first record, I would like to pick the value as 009, for second record I would like to pick up the value as 100 and for the third record as 777( where the field is NOT NUMERIC) etc..

Expected output is

Code:

=COLS> ----+----1----+-
'''''' XXXXXXXXXXXX009
'''''' YYYYYYYYYYYY100
'''''' ZZZZZZZZZZZZ777
'''''' AAAAAAAAAAAA089
'''''' BBBBBBBBBBBB199
'''''' CCCCCCCCCCCC777


Can this be acheived using SORT ?

Thanks for your time
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Feb 15, 2008 11:49 am    Post subject: Reply with quote

Novice,

The following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICEMAN   
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD *               
XXXXXXXXXXXXX09               
YYYYYYYYYYYY100               
ZZZZZZZZZZZZZZZ               
AAAAAAAAAAAAA89               
BBBBBBBBBBBB199               
CCCCCCCCCCCCCCC               
//SORTOUT  DD SYSOUT=*       
//SYSIN    DD *                         
  SORT FIELDS=COPY                       
  INREC IFTHEN=(WHEN=(13,1,ZD,NE,NUM,AND,
                      14,2,ZD,EQ,NUM),   
       OVERLAY=(13:C'0')),               
        IFTHEN=(WHEN=(13,3,ZD,NE,NUM),   
       OVERLAY=(13:C'777'))             
//*                                     


Hope this helps...
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Sun Feb 17, 2008 11:15 pm    Post subject: Reply with quote

Thanks Kolusu.

Novice
Back to top
View user's profile Send private message
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Mon Feb 18, 2008 12:11 am    Post subject: Reply with quote

Kolusu,

I tried the JCL which you have provided and here is
Code:


 Command ===>           
 ****** ****************
 =COLS> ----+----1----+-
 000001 XXXXXXXXXXXX009
 000002 YYYYYYYYYYYY100
 000003 ZZZZZZZZZZZZ777
 000004 AAAAAAAAAAAA777
 000005 BBBBBBBBBBBB199
 000006 CCCCCCCCCCCC777
 ****** ****************


If you look at 4th record, it should have the result as 089 in the last 3 bytes, but it is showing the value as 777.

Could you help me out

Thanks
Novice
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Feb 18, 2008 11:27 am    Post subject: Reply with quote

Novice,

oops my Bad. I forgot that ZD fields has sign overpunch. 'A' is actually represents a value of +1. ZD format for the field if you want to test for zoned decimal numerics ('0'-'9' in all non-sign bytes; X'F0'-X'F9', X'D0'-X'D9' or X'C0'-X'C9' in the sign byte).

We should FS format

Change your control cards to the following

Code:

//SYSIN    DD *                           
  SORT FIELDS=COPY                         
  INREC IFTHEN=(WHEN=(13,1,FS,NE,NUM,AND, 
                      14,2,FS,EQ,NUM),     
       OVERLAY=(13:C'0')),                 
        IFTHEN=(WHEN=(13,3,FS,NE,NUM),     
       OVERLAY=(13:C'777'))               
//*                                       

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Thu Feb 21, 2008 1:57 am    Post subject: Reply with quote

Thanks Kolusu. It worked.

Novice
Back to top
View user's profile Send private message
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Mon Feb 25, 2008 2:15 am    Post subject: Reply with quote

hi Kolusu

I tried the same thing. This is my JCL
Code:
//STEP0100 EXEC PGM=ICEMAN                 
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                           
XXXXXXXXXXXXX09                           
YYYYYYYYYYYY100                           
ZZZZZZZZZZZZZZZ                           
AAAAAAAAAAAAA89                           
BBBBBBBBBBBB199                           
CCCCCCCCCCCCCCC                           
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  SORT FIELDS=COPY                         
  INREC IFTHEN=(WHEN=(13,1,FS,NE,NUM,AND, 
                      14,2,FS,EQ,NUM),     
       OVERLAY=(13:C'0')),                 
        IFTHEN=(WHEN=(13,3,FS,NE,NUM),     
       OVERLAY=(13:C'777'))               
//*                                       


But am getting an abend. This is the message
Code:
SYSIN :                                     
  SORT FIELDS=COPY                           
  INREC IFTHEN=(WHEN=(13,1,FS,NE,NUM,AND,   
                   *                         
                      14,2,FS,EQ,NUM),       
       OVERLAY=(13:C'0')),                   
        IFTHEN=(WHEN=(13,3,FS,NE,NUM),       
       OVERLAY=(13:C'777'))                 
WER268A  INREC STATEMENT   : SYNTAX ERROR   
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Could it be because the Syncsort version used here is different? Please help
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Feb 25, 2008 3:58 am    Post subject: Reply with quote

did you look up the INREC statement in the SYNCSORT manual?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Mon Feb 25, 2008 5:05 am    Post subject: Reply with quote

Nope.. I see that IFTHEN is not allowed in SYNCSORT. Is there an equivalent for the above SYSIN card in syncsort?
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Feb 25, 2008 5:11 am    Post subject: Reply with quote

You will have to wait for SYNCSORT person to turn up. Certainly Kolusu and Frank will not give you an explicit answer because they both work on DFSORT. I've never (knowingly) worked with Syncsort and do not have access to a manual to read up on it.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Mon Feb 25, 2008 10:05 am    Post subject: Reply with quote

can anyone help with the syncsort solution?
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Mon Feb 25, 2008 11:22 am    Post subject: Reply with quote

Edward,

IFTHEN is supported in SyncSort for z/OS 1.2.1 and later. Support for NUM was included in SyncSort for z/OS 1.3. Which release of SyncSort are you running?
_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Tue Feb 26, 2008 12:22 am    Post subject: Reply with quote

Hi Alissa,

This is the version -> SYNCSORT FOR Z/OS 1.2.2.1R
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Tue Feb 26, 2008 5:20 pm    Post subject: Reply with quote

Edward,

The following JCL should produce the desired results using your version of SyncSort:
Code:

//STEP1  EXEC PGM=SORT
//SORTIN DD *                                           
XXXXXXXXXXXXX09                                         
YYYYYYYYYYYY100                                         
ZZZZZZZZZZZZZZZ                                         
AAAAAAAAAAAAA89                                         
BBBBBBBBBBBB199                                         
CCCCCCCCCCCCCCC                                         
//SORTOUT DD SYSOUT=*                                   
//SYSOUT  DD SYSOUT=*                                   
//SYSIN   DD *                                           
   SORT FIELDS=COPY                                     
   INREC IFTHEN=(WHEN=(13,01,SS,NE,C'0123456789',AND,   
                       14,01,SS,NE,C'0123456789',AND,   
                       15,01,SS,NE,C'0123456789'),     
              OVERLAY=(13:C'777')),                     
         IFTHEN=(WHEN=(13,01,SS,NE,C'0123456789',AND,   
                       14,01,SS,EQ,C'0123456789',AND,   
                       15,01,SS,EQ,C'0123456789'),     
              OVERLAY=(13:C'0'))     
/*   

_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Wed Feb 27, 2008 1:47 am    Post subject: Reply with quote

Super!!! It was really a good learning

Thanks very much!! Very Happy
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group