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

Need to validate the field using cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mitha

New User


Joined: 01 Dec 2021
Posts: 19
Location: India

PostPosted: Wed Dec 01, 2021 6:19 pm
Reply with quote

Hi guys, I need to validate the field is in this [ZZZZZZZ9.99] format or not using cobol .If it is in this format need to proceed with further steps .I will do that no problem .But how to validate the field ?/Can anyone help me on this by sharing ur logic or code. Urgent!!!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Dec 01, 2021 9:40 pm
Reply with quote

This is a help forum, where people respond as they have interest, time, and knowledge. Questions may sit on this (or any) forum for hours to weeks to months with no responses -- and that is normal. If you need urgent, have your management contract with someone to help you.

The best bet would be to use REDEFINES on the variable to have it available as an alphanumeric (PIC X) variable. You can then use reference modification to check each byte of the REDEFINED variable to be zero through nine or decimal point.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Wed Dec 01, 2021 11:43 pm
Reply with quote

DFSORT ? You can try as you don’t want to do with COBOL.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Dec 02, 2021 12:39 am
Reply with quote

Quote:
You can then use reference modification to check each byte of the REDEFINED variable to be zero through nine or decimal point.


But leading bytes may be spaces, and decimal point placed correctly.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Sun Dec 05, 2021 2:39 am
Reply with quote

Look up TEST-NUMVAL function in the COBOL language reference.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top