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

Feild level validation to test first 5 are numbers


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sruthi3466

New User


Joined: 23 Apr 2020
Posts: 1
Location: singapore

PostPosted: Thu Apr 23, 2020 2:47 pm
Reply with quote

Hi,

I have a file containing lot of fields. The first field is fixed set of say 10 characters. My requirement is out of the 10 characters the first 5 should be always numeric.

Incase they are not number, I should be able to write those lines to a different file.

Eg:

12345iam
6789#how
89012wha
12345678
hi123how

Here the 2nd & 5th rows are invalid as the first 5 should be numeric. Hence want this to be written into a different file.

Requesting for an early reply.

Thanks

Sruthi
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1246
Location: Bamberg, Germany

PostPosted: Thu Apr 23, 2020 3:01 pm
Reply with quote

You can request what you want. Show us what you have tried so far and you may get an answer. Beside that I can't see what it has to do with JCL or VSAM.

Use Code tags next time when posting data.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2019
Location: USA

PostPosted: Thu Apr 23, 2020 4:23 pm
Reply with quote

sruthi3466 wrote:
Incase they are not number, I should be able to write those lines to a different file.

To do this, you must be able to create some code for any of programming language and/or programming tool.

1) What programming languages you know?
2) What programming tools you know?
3) What do you know about JCL?
4) What do you know about VSAM?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Apr 23, 2020 4:35 pm
Reply with quote

Put it this way:
1 - I suspect, but do not know, that you are wanting a sort solution but you a) failed to mention this and b) did not post in either sort section of the forum
2 - If you want it quick then do not post on a forum - the people responding do so in their spare time. Their time may be precious so you should present your query fully and clearly and accurately
3 - data and code should be presented using the code tags - you can figure out for yourself how to do this if you use the POST REPLY button and/or read form posts telling you how to do this
4 - zOS data is kept in data sets - hence DSN for Data Set Name - not files. In zOS a file is the stream of data from a data set or device (such as a modem) to your program
5 - Welcome to the Expert Forum. If you are inexperienced then the sister forum - Beginners Forum - would be a more appropriate place to post your questions.
6 - Links to manuals can be found at the very top of each page or you can Google for them.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Apr 24, 2020 5:13 am
Reply with quote

There are many ways - I assume the field starts 1-10 byes.

One way to try is this ,
Code:
INCLUDE COND=(1,5,FS,EQ,NUM)


Second way to to include using SS
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1246
Location: Bamberg, Germany

PostPosted: Fri Apr 24, 2020 12:44 pm
Reply with quote

Rohit Umarjikar wrote:
Second way to to include using SS

Mind sharing this approach?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2019
Location: USA

PostPosted: Fri Apr 24, 2020 4:34 pm
Reply with quote

Rohit Umarjikar wrote:
There are many ways - I assume the field starts 1-10 byes.

One way to try is this ,
Code:
INCLUDE COND=(1,5,FS,EQ,NUM)


1) This approach has nothing to do with neither JCL, nor VSAM, - as required by the chosen forum.

2) depending on actual criteria (not clear from the TS explanation) it might be also
Code:
INCLUDE COND=(1,5,ZD,EQ,NUM)


3) if splitting to different files is required, need to be changed
Code:
 . . . . .
 OUTFIL FNAMES=GOODDATA,
        INCLUDE=(1,5,ZD,EQ,NUM)
 OUTFIL FNAMES=BADDATA,
        SAVE
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Apr 24, 2020 7:50 pm
Reply with quote

Joerg.Findeisen wrote:
Rohit Umarjikar wrote:
Second way to to include using SS

Mind sharing this approach?

Code:
INCLUDE COND=(1,1,SS,EQ,C'0123456789', AND,
              2,1,SS,EQ,C'0123456789', AND,
              3,1,SS,EQ,C'0123456789', AND,
              4,1,SS,EQ,C'0123456789', AND,
              5,1,SS,EQ,C'0123456789')
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Apr 24, 2020 7:54 pm
Reply with quote

sergeyken wrote:
Rohit Umarjikar wrote:
There are many ways - I assume the field starts 1-10 byes.

One way to try is this ,
Code:
INCLUDE COND=(1,5,FS,EQ,NUM)


1) This approach has nothing to do with neither JCL, nor VSAM, - as required by the chosen forum.

2) depending on actual criteria (not clear from the TS explanation) it might be also
Code:
INCLUDE COND=(1,5,ZD,EQ,NUM)


3) if splitting to different files is required, need to be changed
Code:
 . . . . .
 OUTFIL FNAMES=GOODDATA,
        INCLUDE=(1,5,ZD,EQ,NUM)
 OUTFIL FNAMES=BADDATA,
        SAVE

1. It should be moved to DFSORT/ SYNCSORT based on the product TS uses.
2.It could be FS or ZD, TS would need to decide that, I assumed FS since it was not provided.
3. I just gave an idea and not the complete solution since TS is expected to do that at the least.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1246
Location: Bamberg, Germany

PostPosted: Fri Apr 24, 2020 9:06 pm
Reply with quote

Rohit Umarjikar wrote:

Code:
INCLUDE COND=(1,1,SS,EQ,C'0123456789',AND,
              2,1,SS,EQ,C'0123456789',AND,
              3,1,SS,EQ,C'0123456789',AND,
              4,1,SS,EQ,C'0123456789',AND,
              5,1,SS,EQ,C'0123456789')

Thank you. I was guessing this would be your solution but sometimes an old dog learns new tricks. icon_smile.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Apr 24, 2020 11:56 pm
Reply with quote

Joerg.Findeisen wrote:
Rohit Umarjikar wrote:

Code:
INCLUDE COND=(1,1,SS,EQ,C'0123456789',AND,
              2,1,SS,EQ,C'0123456789',AND,
              3,1,SS,EQ,C'0123456789',AND,
              4,1,SS,EQ,C'0123456789',AND,
              5,1,SS,EQ,C'0123456789')

Thank you. I was guessing this would be your solution but sometimes an old dog learns new tricks. icon_smile.gif

That's always true for everyone, No exception whatsoever,. Learning never stops if desired. 2014.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts How to load to DB2 with column level ... DB2 6
No new posts Generate random number from range of ... COBOL Programming 3
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts Zunit Test case editor error Testing & Performance 4
Search our Forums:

Back to Top