Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To valiate more than one field in same record using IFTHEN??

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
seethaRam10

New User


Joined: 03 Feb 2011
Posts: 4
Location: chennai

PostPosted: Thu Feb 10, 2011 7:03 pm    Post subject: To valiate more than one field in same record using IFTHEN??
Reply with quote

HI All,
I have one sort card which will validate the binary and PD fields for less than 0 and non numeric(for PD) and write the records in the output file with description.Now its working fine if each record has one invalid field.

Please refer my code below.
Code:
//TINSRPT1   JOB (DWR,SYS999,TSO--TC3,P70BJK,TSTA),' TIP JCL',
//        CLASS=P,MSGCLASS=X,NOTIFY=&SYSUID,REGION=4M
//UCC11    EXEC UCC11RMS,TYPRUN=P
//S010     EXEC PGM=SORT
//SORTIN  DD DSN=TSTA.NDM.CONV.RCV.TIP.DT100211,DISP=SHR
//SORTOUT  DD DSN=TSTA.NDM.CONV.RCV.TIP.D100211.VALID4,
//        DISP=(,CATLG,DELETE),SPACE=(CYL,(50,5),RLSE)
//SYSOUT   DD SYSOUT=*
//SYSIN  DD *
  SORT FIELDS=COPY
  INCLUDE COND=(1,2,BI,LT,0,OR,3,2,BI,LT,0,OR,31,2,BI,LT,0,OR,
       56,2,BI,LT,0,
       OR,118,6,PD,LT,0,OR,124,6,PD,LT,0,OR,164,5,PD,LT,0,OR,169,2,PD,
       LT,0,OR,171,2,PD,LT,0,OR,173,2,PD,LT,0,OR,246,7,PD,LT,0,
       OR,257,8,PD,LT,0,OR,265,8,PD,LT,0,OR,273,8,PD,LT,0,OR,
       118,6,PD,NE,NUM,OR,124,6,PD,NE,NUM,OR,164,5,PD,NE,NUM,OR,
       169,2,PD,NE,NUM,OR,171,2,PD,NE,NUM,OR,173,2,PD,NE,NUM,OR,
       246,7,PD,NE,NUM,OR,257,8,PD,NE,NUM,OR,265,8,PD,NE,NUM,OR,
       273,8,PD,NE,NUM)
    OUTREC IFTHEN=(WHEN=(1,2,BI,LT,0),
           BUILD=(1:1,57,61:C'MONTH',91:C'NEGATIVE')),
           IFTHEN=(WHEN=(3,2,BI,LT,0),
           BUILD=(1:1,57,61:C'NUM SEG',91:C'NEGATIVE')),
           IFTHEN=(WHEN=(31,2,BI,LT,0),
           BUILD=(1:1,57,61:C'NUM ACCT TYPE',91:C'NEGATIVE')),
           IFTHEN=(WHEN=(56,2,BI,LT,0),
           BUILD=(1:1,57,61:C'YEAR',91:C'NEGATIVE')),
           IFTHEN=(WHEN=(118,6,PD,LT,0),
           BUILD=(1:1,57,61:C'AMT INVESTD PREM',91:C'NEGATIVE'))


Now my requirement is if any one record has 2 invalid fields it should be written 2 times in the output file with description(negative or non-numeric).
Also please help me out writing the header for the above records.I am using the below one
Code:
OUTFIL REMOVECC,
    HEADER1=('KEY FIELD ********************************************',
     '******DISCREPANT********************ISSUE TYPE
but it was giving me the syntax error


Thanks & Regards,
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Feb 11, 2011 2:51 am    Post subject:
Reply with quote

seethaRam10,

There are a couple of problems with your INCLUDE condition. If you really want to test for negative numbers then you need to use FI format instead of BI format.

Looking at your OUTREC statements, you are only validating 5 fields. Why can't you include only records which would be true for those conditions?

If you want to evaluate more than 1 field on the same record , you need to use HIT=NEXT on each of the IFTHEN statements.
Back to top
View user's profile Send private message
seethaRam10

New User


Joined: 03 Feb 2011
Posts: 4
Location: chennai

PostPosted: Fri Feb 11, 2011 1:44 pm    Post subject: Reply to: To valiate more than one field in same record usin
Reply with quote

Hi Skolusu,

Many thanks for your reply..

I have pasted only part of my code to conserve the space .Actually I am validating the all the fields in my sort card..
I have tried HIT=NEXT but it is building the statement of last IFTHEN.

Please refer my code below
Code:
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,2,FI,LT,0),
         BUILD=(1:1,57,61:C'MONTH',91:C'NEGATIVE'),HIT=NEXT),
         IFTHEN=(WHEN=(3,2,FI,LT,0),
         BUILD=(1:1,57,61:C'NUM SEG',91:C'NEGATIVE'),HIT=NEXT),
         IFTHEN=(WHEN=(31,2,FI,LT,0),
         BUILD=(1:1,57,61:C'NUM ACCT TYPE',91:C'NEGATIVE'),HIT=NEXT),
         IFTHEN=(WHEN=(56,2,FI,LT,0),
         BUILD=(1:1,57,61:C'YEAR',91:C'NEGATIVE'),HIT=NEXT),
         IFTHEN=(WHEN=(118,6,PD,LT,0),
         BUILD=(1:1,57,61:C'AMT INVESTD PREM',91:C'NEGATIVE'),
         HIT=NEXT),
         IFTHEN=(WHEN=(118,6,PD,NE,NUM),
         BUILD=(1:1,57,61:C'AMT INVESTD PREM',91:C'NONNUMERIC'))
OUTFIL REMOVECC,
    HEADER1=('**********************KEY FIELDS:*********************',
     '***  DISCREPANT:******************ISSUE TYPE:')


Please find my outout below.
Code:
***  DISCREPANT:******************ISSUE TYPE:
.¹   AMT INVESTD PREM              NONNUMERIC
.¹   AMT INVESTD PREM              NONNUMERIC


Thanks & Regards,
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: Fri Feb 11, 2011 10:08 pm    Post subject:
Reply with quote

Telling us what you did that didn't work without explaining what you're trying to do is really not very helpful.

You need to start over and explain clearly what it is you're trying to do.

Please show an example of the records in your input file (relevant fields only) and what you expect for output. Include the cases that aren't working. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files.

Also, run this job and show the //SYSOUT messages you receive, so I can see what level you're at:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DUMMY
//SYSIN    DD    *
    OPTION COPY
/*
Back to top
View user's profile Send private message
seethaRam10

New User


Joined: 03 Feb 2011
Posts: 4
Location: chennai

PostPosted: Tue Feb 15, 2011 12:40 pm    Post subject: Reply to: To valiate more than one field in same record usin
Reply with quote

Hi Frank

Please find below the //SYSOUT messages for the job you have given
Code:
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 40BE0, MODEL 2817 735
SYSIN :
    OPTION COPY
WER276B  SYSDIAG= 2467164, 4229465, 4229465, 1889100
WER164B  6,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B     0 BYTES RESERVE REQUESTED, 272K BYTES USED
WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I  SORTIN   : RECFM=FB   ; LRECL=    80; BLKSIZE=    80
WER110I  SORTOUT  : RECFM=FB   ; LRECL=    80; BLKSIZE=    80
WER410B  5,856K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B     0 BYTES RESERVE REQUESTED, 156K BYTES USED
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B  BSAM WAS USED FOR SORTIN
WER416B  BSAM WAS USED FOR SORTOUT
WER054I  RCD IN          1, OUT          1


Coming to my requirement:
I have a file having records with 4 comp and 6 comp-3 fields.I have to validate these fields for negative,non-numeric(for PD) and build the output as a report showing the discrepancy.
Please find the sample records in my file.
Code:

BI      BI       BI     BI        PD      PD        PD           PD
(1-2) (3-4) (31-32) (56-57) (118-123) (124-129) (164-168) (169-170)
-7     -71    0      2010    33000.00    0            0        20   
 7     -72    0      -2010   50000.00    0            0        90
 
PD             PD
(265-272)  (273-280)
 221.00     81807.43
10100.00   0



The output I was expecting is
Code:

Field name      discrepancy
(1-2)              NEGATIVE       
(3-4)              NEGATIVE
(56-57)            NEGATIVE
(265-272)          NEGATIVE


As there are 2 discrepancies for the same record it should be built 2 times showing the 2 discrepancies.

Please find the OUTREC i am using now.

Code:

OUTREC IFTHEN=(WHEN=(1,2,FI,LT,0),BUILD=(106:C'DTE-MONTH',126:C'NEGATIVE')),
        IFTHEN=(WHEN=(3,2,FI,LT,0),BUILD=(106:C'NUM-SEG',
       126:C'NEGATIVE')),
      IFTHEN=(WHEN=(56,2,FI,LT,0),BUILD=(106:C'DTE-YEAR',126:C'NEGATIVE')),
    IFTHEN=(WHEN=(265,8,PD,LT,0)BUILD=(106:C'AMT-NET',126:C'NEGATIVE')),


The record format is FB and record length is 333 bytes.
I had used the HIT=NEXT option for IFTHEN conditions ,its validating the next field of the same record but overriding on the same record in the output.

Please let me know is there any way to build the same record as many times as the no. of invalid fields in it(2 invalid fields means it should print 2 times).
Also to count the records based on the invalid fields.
Code:

(INVALID RECS WITH DTE-MONTH  1
(INVALID RECS WITH DTE-YEAR  1)


Please let me know if you need any more details
Thanks for your time
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Feb 15, 2011 12:59 pm    Post subject:
Reply with quote

According to your output you are using SYNCSORT, not DFSORT.

Frank and Kolusu are DFSORT developers. SYNCSORT is a competitor product and your query should be posted in the JCL forum, not the DFSORT forum.

Garry.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Wed Feb 16, 2011 11:52 am    Post subject:
Reply with quote

Quote:
Please let me know is there any way to build the same record as many times as the no. of invalid fields in it(2 invalid fields means it should print 2 times). Also to count the records based on the invalid fields.
It is true that using HIT=NEXT will make the subsequent IFTHEN checks also even if one IFTHEN condition is satisfied.
But YOU need to take care of not losing the data already OVERLAYed at some position by NOT giving the same output position in all the IFTHEN OVERLAYs.

It is not clear how your expected output should look like. It might help if you post here the expected output records for a few sample input data records.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Fri Feb 18, 2011 2:05 pm    Post subject:
Reply with quote

Hello Seetharam,

If i understood your requirement correctly, What you could possibly do is to try writing the output in multiple files using OUTFIL statments as shown below.

Code:
//PS0100    EXEC PGM=SORT                                   
//SORTIN    DD *                                             
1-6-
2-5-
3-4-
4-3-
5-2-
6-1-                                                     
//SORTOF01  DD DSN=OUT DSN1                                     
//SORTOF02  DD DSN=OUT DSN2                                     
//SYSPRINT  DD SYSOUT=*                                     
//SYSUDUMP  DD SYSOUT=I                                     
//SYSOUT    DD SYSOUT=*                                     
//SYSIN  DD *                                               
  SORT FIELDS=COPY                                       
                                                         
  OUTFIL FILES=01,INCLUDE=(1,2,FI,LT,0),                 
  HEADER1=('INVALID MONTH'),                             
  OUTREC=(1:1,2,26:C'MONTH',35:C'NEGATIVE'),             
  TRAILER1=(1:C'INVALID RECORDS WITH DTE-MONTH:',       
            35:COUNT=(TO=ZD,LENGTH=8))                   
                                                         
  OUTFIL FILES=02,INCLUDE=(3,2,FI,LT,0),                 
  HEADER1=('INVALID NUMSEG'),                           
  OUTREC=(3:1,2,26:C'NUM SEG',35:C'NEGATIVE'),           
  TRAILER1=(1:C'INVALID RECORDS WITH NUM SEG  :',       
            35:COUNT=(TO=ZD,LENGTH=8))                   


First output file

Code:
INVALID MONTH                             
1-                       MONTH    NEGATIVE
2-                       MONTH    NEGATIVE
3-                       MONTH    NEGATIVE
4-                       MONTH    NEGATIVE
5-                       MONTH    NEGATIVE
6-                       MONTH    NEGATIVE
INVALID RECORDS WITH DTE-MONTH:   00000006


2nd output file

Code:
INVALID NUMSEG                             
6-                       NUM SEG  NEGATIVE
5-                       NUM SEG  NEGATIVE
4-                       NUM SEG  NEGATIVE
3-                       NUM SEG  NEGATIVE
2-                       NUM SEG  NEGATIVE
1-                       NUM SEG  NEGATIVE
INVALID RECORDS WITH NUM SEG  :   00000006


I hope this will help you. If this is not what you required, as others told please elaborate the requirement.
Back to top
View user's profile Send private message
seethaRam10

New User


Joined: 03 Feb 2011
Posts: 4
Location: chennai

PostPosted: Tue Feb 22, 2011 1:24 pm    Post subject: Reply to: To valiate more than one field in same record usin
Reply with quote

Hi kratos86.

Thanks for ur help ..
I got the output by using multiple output files with OUTFIL statements and then merged again all of them ..


Thanks & Regards,
SeethaRam
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us