Problem using validation pattern



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Problem using validation pattern

Postby matthieu_merlyn » Tue Oct 02, 2012 8:11 pm

Hi,

I want to test a field using the following validation pattern :
- first position should be '+' or numeric
- all other positions should be numeric or spaces. If this is not the case, all positions within the field should become spaces.

Furthermore, in the output record, the field should be squeezed to the left and remain 10 positions (trailing blanks).
Syncsort version used = 1.3.2.1R

Input record consists of a five position key (which has to be kept), a ten position field (for which the conditions as described above should apply) and a five position field (which has to be kept).

Example input record :
key011234567890aaaaa
key02123 56 8  aaaaa
key03123a56b890aaaaa
key04+555555555aaaaa
key05         5aaaaa
key06          aaaaa
key07+23a56b890aaaaa


Desired output record :
key011234567890aaaaa
key02123568    aaaaa
key03          aaaaa
key04+555555555aaaaa
key055         aaaaa
key06          aaaaa
key07          aaaaa


I have tried a number of combinations using PARSE and SQZ, but none with the desired results. Any suggestions?
Thanks in advance!
matthieu_merlyn
 
Posts: 2
Joined: Mon Apr 23, 2012 11:23 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Problem using validation pattern

Postby BillyBoyo » Tue Oct 02, 2012 8:22 pm

I don't have access to a SyncSort manual, but you do.

Have a look in the index or by searching for a numeric test. You'll then have to apply an IFTHEN for each byte, testing for +/numeric/space for the first, numeric/space for the subsequent bytes.

Or, another idea. OVERLAY your 10-byte field to the end of the record. Use FINDREP on that extended field to change + to 0 and space to 0. Then test the whole field for numeric. Once finished with the field, you can forget about it (BUILD, IFOUTLEN).

Can you show us what is not working with the SQZ?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Problem using validation pattern

Postby matthieu_merlyn » Wed Oct 03, 2012 7:19 pm

It was not so much SQZ itself that was not working, I meant that I had a problem with the combination that I was trying out (using PARSE and SQZ and ...). Sorry if that was unclear.
Anyway, your idea of overlaying the field to the end of the record and using the find/replace with a numeric check turned out to work out just fine. Thanks a lot for your help!
matthieu_merlyn
 
Posts: 2
Joined: Mon Apr 23, 2012 11:23 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Problem using validation pattern

Postby bodatrinadh » Thu Oct 04, 2012 4:11 pm

Hi Matthieu,

Try this snippet..

                           
//STEP1   EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
ALPHA,C'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z'
//SORTIN   DD *                                                   
KEY011234567890AAAAA
KEY02123 56 8  AAAAA
KEY03123A56B890AAAAA
KEY04+555555555AAAAA
KEY05         5AAAAA
KEY06          AAAAA
KEY07+23A56B890AAAAA
//SORTOUT DD SYSOUT=*
//SYSIN    DD *
  INREC IFTHEN=(WHEN=(6,10,SS,EQ,C' '),
                OVERLAY=(06:6,10,SQZ=(SHIFT=LEFT))),
        IFTHEN=(WHEN=(6,1,SS,EQ,ALPHA,OR,7,1,SS,EQ,ALPHA,OR,
        8,1,SS,EQ,ALPHA,OR,9,1,SS,EQ,ALPHA,OR,10,1,SS,EQ,ALPHA,OR,
       11,1,SS,EQ,ALPHA,OR,12,1,SS,EQ,ALPHA,OR,13,1,SS,EQ,ALPHA,OR,
       14,1,SS,EQ,ALPHA,OR,15,1,SS,EQ,ALPHA),
               OVERLAY=(06:10X))
  SORT FIELDS=COPY


And Output :-

KEY011234567890AAAAA
KEY02123568    AAAAA
KEY03          AAAAA
KEY04+555555555AAAAA
KEY055         AAAAA
KEY06          AAAAA
KEY07          AAAAA
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post