Friday, 1 December 2017

كوبول - الصورة - بند ثنائي - خيارات


بند أوسيج يحدد بند أوسيج تنسيق عنصر بيانات في ذاكرة الكمبيوتر أو في سجل ملف. في بعض الحالات، قد يختلف تنسيق سجل ملف عنصر البيانات عن تنسيق ذاكرة الكمبيوتر كما هو محدد في بند أوسيج هذا يمكن تحدث عندما يتم الوصول إلى أنظمة الملفات غير كوبول مع تنسيقات تخزين البيانات المختلفة من خلال واجهة على سبيل المثال، يستخدم Acu4GL سكل للوصول إلى أنظمة الملفات غير كوبول، وفي عملية تحدث ترجمة على البيانات. ملاحظة هناك العديد من الخيارات مترجم ل مما يؤثر على سلوك تخزين البيانات راجع خيارات تخزين البيانات في قسم التوافق أكوكوبول-غ. يظهر العمود الموجود على اليسار الاختصارات المقبولة للمصطلحات الموجودة على اليمين. يمكن استخدام بند الاستخدام في أي إدخال وصف البيانات باستثناء تلك التي تحتوي على أرقام مستوى 66 و 78 و 88. قد لا يتم استخدام بند الاستخدام مع عنصر بيانات نقطة عائمة خارجية. إذا كان شرط أوسيج في إدخال وصف البيانات لعنصر مجموعة، ثم أي بنود الاستخدام التي تظهر ل إنتري ثانوي s يجب أن تكون من نفس النوع. سلسلة بيكتيور من كومب أو كومب-1 أو كومب-2 أو كومب-3 أو كومب-4 أو كومب-5 أو كومب-6 أو بيناري أو بيمد-ديسيمال يمكن أن تحتوي فقط على قد لا تحتوي الرموز 9 و S و V و P كومب-6 عناصر على الرمز S. سلسلة بيكتيور لعنصر كومب-X أو كومب-N قد تحتوي فقط على جميع الرموز 9 أو كل الرموز X. إدخال بيانات البيانات ل لا يمكن أن يحتوي عنصر بيانات إندكس إس إندكس على أي من العبارات التالية فارغة عند زيرو و جوستيفيد و بيكتيور و فالو إس. Level 88 قد لا يتم تحديد عناصر ل أوساج إس إندكس داتا item. The داتا دسكريبتيون إنتري فور أوسيج إس بوينتر داتا إيتم لا يمكن أن تحتوي على أي من العبارات التالية فارغة عند زيرو أو جاستيفيد أو بيكتيور A بوينتر عنصر البيانات قد يكون لها شرط قيمة المحدد لذلك ولكن يجب أن تكون القيمة الكلمة NULL. The إدخال وصف البيانات ل أوساج إس فلوت أو استخدام هو لا يمكن أن يحتوي بند بيانات مزدوج على أي من العبارات التالية فارغة عند زيرو أو جوستيفيد أو بيكتيور فلوت أو عناصر بيانات مزدوجة قد يكون لها شرط قيمة قيمة ما y تكون نقطة عائمة حرفية أو حرفية رقمية أو كلمة زيرو هنا مثال على عنصر بيانات قسم تخزين العمل. ويسمى ما يلي بشكل جماعي أنواع بيانات النمط C تم التوقيع عليها - إنت، أونسيغند-إنت، سيغند-شورت ، أونسيغند-شورت، سيغند-لونغ، أونسيغند-لونغ هذه الأنواع من البيانات مماثلة لأنواع البيانات الموجودة في لغة برمجة C. إدخال بيانات البيانات لنوع بيانات نمط C لا يمكن أن يحتوي على أي من العبارات التالية فارغة عند صفر، المعرف أو PICTURE. Control من النوع هو واحد من أسماء نوع التحكم الرسومية المعروفة للمترجم، مثل لابيل أو إنتري-فيلد أو اسم أكتيفكس أو كوم أو عنصر التحكم. إدخال وصف البيانات لعناصر بيانات أوسيج هاندل قد لا تحتوي على أي من العبارات التالية فارغة عند زيرو أو جوستيفيد أو بيكتيور إذا كان يحتوي على جملة فالو، يجب أن تكون القيمة المحددة هي الكلمة NULL. Font-نيم هي واحدة من المعرفات التالية ديفولت-فونت، فيكسيد-فونت، تراديتيونال - FONT، سمال-فونت، متوسط-فونت، LARGE-FONT. It تجدر الإشارة إلى أن إما الخيار - Df أو الخيار - Cv سوف يسبب المترجم لمعالجة كومب-1 و كومب-2 كما فلوت و دوبل، على التوالي لمزيد من المعلومات، انظر القسم 5 4 في الانتقال إلى أكوكوبول-GT. Layout اسم هو الاسم واحدة من نظام مديري تخطيط القياسية حاليا، وهذا يمكن أن يكون إلا لم-RESIZE. A استخدام العبارة المكتوبة على مستوى المجموعة ينطبق على كل عنصر أساسي تابع لهذا البند المجموعة. إذا لم يتم تحديد شرط الاستخدام، ثم استخدام هو ديسبلاي هو ضمنية. التنسيق الداخلي للعنصر إس ديسبلاي هو أسي. تنسيق عنصر الفهرس هو 32 بت بتوقيع ثنائي حجمه هو دائما أربعة، ويحمل مجموعة من القيم من -2147483647 إلى 2147483647 عند استخدام مفتاح التحويل البرمجي التوافق مع الإصدارات قبل 6 0 0 - Z52 على سبيل المثال عنصر فهرس هو ثنائي بت 16 بت غير موقعة، وحجم دائما اثنين، ويحمل قيم من 0 إلى 65535. تنسيق عنصر بيانات كومب-1 هو 16 بت وقعت ثنائي تتراوح القيم القانونية من -32767 إلى 32767 حجم عنصر البيانات هو دائما اثنين بايت، ويتم تخزين النصف العلوي من البيانات في بايت أقصى اليسار سلسلة بيكتيور التي تصف العنصر غير ذات صلة على عكس أنواع البيانات الرقمية الأخرى، سيحدث خطأ حجم على كومب-1 أو كومب-X أو COMP - N فقط عندما تتجاوز القيمة التخزين الفعلي للعنصر وبعبارة أخرى، يتم تجاهل عدد 9 s في الصورة s بيكتيور عند تحديد حجم الخطأ. للمخزن العشري كومب-2، يتم تخزين كل رقم في بايت واحد في نسق عشري إذا تم توقيع القيمة، يتم تخصيص بايت زائدة إضافية للعلامة تخزين كومب-2 متطابق مع أوسب ديسبلاي مع أربع بتات عالية تجريدها من كل بايت. لمجموعة كومب-3 معبأة العشرية التخزين ، يتم تخزين رقمين في كل بايتة يتم تخصيص نصف بايت إضافي للعلامة، حتى إذا كانت القيمة غير موقعة يتم وضع العلامة في أقصى موضع، وقيمتها 0x0D بالنسبة إلى جميع القيم الأخرى السلبية تعامل على أنها إيجابية ولكن انظر القاعدة 18 أدناه حجم البند بما في ذلك واحد ل إبل تنقسم علامة إيد من قبل اثنين للوصول إلى حجمها الفعلي التقريب الكسور يصل. شكل عنصر كومب-4 هو اثنين s - مكمل ثنائي القيمة دون قيمتها العشرية يتم تخزين قيم كومب-4 في شكل آلة مستقلة هذا الشكل يضع أعلى ترتيب جزء من القيمة في أقصى اليسار موقف ويتبع وصولا إلى الجزء منخفض الترتيب في أقصى اليمين موقف عدد وحدات البايت عنصر بيانات تحتل يعتمد على عدد من 9 ثانية في بيكتيور وعلى وجود مختلف خيارات الوقت التجميعي على سبيل المثال، يمكنك تضمين أكثر من ثمانية عشر 9 ثانية فقط إذا تم تجميع البرنامج الخاص بك للحصول على دعم مكون من 31 رقما يتم تلخيص ذلك في الجدول التالي. ملاحظة حيث يتم إعطاء قيمتين، تنطبق القيمة الأصغر على عناصر البيانات غير الموقعة ، والقيمة الأكبر تنطبق على عناصر البيانات الموقعة -5 يستخدم في المقام الأول للتواصل مع البرامج الخارجية التي تتوقع تخزين البيانات الأصلية. شكل عنصر بيانات كومب-5 مطابق لعنصر بيانات كومب-4، باستثناء أن البيانات المخزنة في آلة د نسق ظاهر يتم تخزينه في أمر طبيعي للجهاز المضيف على سبيل المثال، عنصر البيانات بيك S9 9 كومب-5 يعادل كلمة ثنائية 32 بت على الجهاز المضيف، و بيك S9 20 كومب-5 البند ما يعادل كلمة 64 بت. ملاحظة قد لا تكون البيانات المخزنة في حقل كومب-5 قابلة للنقل إلى أجهزة أخرى لأن الأجهزة المختلفة لها ترتيب البايت الطبيعي مختلفة على العديد من الآلات 68000، معظم ريس، كومب-5 مطابق ل COMP - 4 على الآخرين 80x86، فاكس، هو نفسه مع وحدات البايت في الترتيب العكسي. يتم تخزين شرط فالو لعنصر بيانات كومب-5 في شكل آلة مستقلة ويتم تعديلها عندما يتم تحميلها في عنصر البيانات هذا يضمن أن القيمة هي نفسها من آلة إلى آلة. على الحسابات الحسابية وغير الحسابية إلى كومب-5 البنود، إذا اقتطاع مطلوب، افتراضيا أكوكوبول-غ اقتطاع في عشري إلى عدد من الأرقام الواردة في شرط بيكتيور يمكنك استخدام - TruncANSI خيار المترجم لإجبار اقتطاع في ثنائي إلى قدرة التخصيص تخزين - Dz و - noTrunc الخيارات أيضا اقتطاع انظر كتاب 1، القسم 2 1 9، خيارات تخزين البيانات، لمزيد من المعلومات. المستوى 01 ومستوى 77 عناصر البيانات التي يتم كومب-5 تتم مزامنة تلقائيا إلى حدود آلة مناسبة بغض النظر عن أي إعدادات وقت تجميع يسمح لك بتمرير هذه العناصر بأمان إلى سوبروتينس C دون الحاجة إلى القلق نفسك مع المحاذاة. إذا تم استخدام كومب-5 مع عنصر البيانات بيك X ن وتعيين قيمة أبجدية رقمية ، يتم تعريف النتائج على سبيل المثال، يؤدي شفر التعليمات البرمجية التالية نوم إلى أن يكون عدد غير معروف والقيمة الناتجة عن السطر الأخير سيكون 100. لا يمكن توقيع عنصر البيانات بيك X n المستخدمة مع كومب-5. تنسيق البند كومب-6 مطابق لعنصر كومب-3 إلا أنه غير موقعة ولا يتم تخصيص مساحة للشارة إذا كان عدد الأرقام غريبا، يتم إضافة صفر إلى الطرف الأيسر من الرقم قبل تعبئته. هي رقمين عشريين لكل بايت، والحجم الفعلي لل يتم تحديد العنصر بقسمة حجم بيكتيور بمقدار اثنين وتقريب أعلى. يجب وصف عنصر بيانات كومب-X بسلسلة صورة تتكون من 9 رموز فقط أو X فقط. وفي كلتا الحالتين، يتم التعامل مع عنصر البيانات على أنه رقم صحيح ثنائي غير موقعة ، مع وحدة تخزين داخلية مماثلة لتلك الموجودة في عنصر بيانات كومب-4 إذا كانت الرموز X تستخدم لوصف العنصر، فإن عدد البايتات المخصصة لهذا البند هو نفس عدد الرموز X في سلسلة الصورة إذا كانت 9 رموز هي تستخدم بدلا من ذلك، فإن عدد وحدات البايت المخصصة هو أقل عدد من البايتات المطلوبة لعقد عدد من هذا الحجم على سبيل المثال، سيتم تخصيص عنصر بيانات بيك 99 بايتة سيتم تخصيص عنصر بيانات بيك 9 9 4 بايتات. وبغض النظر عن يتم تحديد القيمة القصوى التي يمكن تخزينها في عنصر كومب-X بعدد 9 رموز في سلسلة الصورة S من حيث عدد البايتات المخصصة لها بحد أقصى 18 رقما أو بحد أقصى 31 رقما إذا كانت 31 دعم - digit هو في الواقع على سبيل المثال، عنصر كومب-X تتكون من 1 ب يمكن أن تعقد ييت مجموعة من الأرقام من 0 إلى 255 A 2 بايت كومب-X عدد يمكن أن تعقد من 0 إلى 65535 يحدث خطأ حجم على عنصر كومب-X فقط عندما تكون القيمة أكبر من عنصر البيانات يمكن أن تعقد جسديا عندما كومب - X مع عنصر بيانات بيك X، الحد الأقصى هو بيك X 8 ويزيد هذا الحد الأقصى إلى بيك X 16 عندما يكون الدعم المكون من 31 رقما ساريا. A عنصر بيانات كومب-N مطابق لعنصر بيانات كومب-X، باستثناء أن يتم تخزين البيانات في تنسيق الجهاز المضيف الأصلي، بدلا من شكل آلة مستقلة. عناصر البيانات الموصوفة على أنها باكيد-ديسيمال متطابقة مع كومب-3 يمكنك أن يسبب غير موقعة باكيد-ديسيمال ليتم التعامل معها على أنها كومب-6 باستخدام خيار وقت تجميع. بشكل افتراضي، عنصر بيانات بيناري مطابق لعنصر بيانات كومب-4 يتعامل خيار تجميع الوقت - D5 مع عناصر البيانات بيناري كعناصر كومب-5 بدلا من ذلك. في وضع التوافق كومب-فاكس، عنصر بيانات كومب هو نفس كومب-4 ويتم التعامل مع البيانات الثنائية في وضع التوافق آرإم كوبول، كومب هو نفس كومب-2 يمكنك استخدام خيارات الوقت تجميع ل تشا نج يتم التعامل مع عنصر البيانات المؤشر كعنصر بيانات رقمي غير موقعة يختلف التنسيق الداخلي لكل جهاز الغرض من عناصر بيانات المؤشر الاحتفاظ بعناوين عناصر بيانات أخرى راجع عنصر بيانات مؤشر سيت سيت A قد يحتوي على شرط فالو المحدد لذلك، يجب أن تكون القيمة المحددة الكلمة نول هذا يشير إلى أن المؤشر لا يشير حاليا إلى أي عنصر إذا لم يتم إعطاء مؤشر صراحة قيمة أولية، ثم قيمته الأولية هي تعسفية. البنود بيانات المؤشر تحتل 8 بايت هذا يوفر مساحة كافية لعقد عنوان على جهاز 64 بت إذا كنت على جهاز أصغر، وقت التشغيل يستخدم فقط 4 بايت الأولى من عناصر بيانات المؤشر تبقى 4 بايت زائدة في الذاكرة، وأنها تركت فقط غير المستخدمة يمكنك استخدام - خيار وقت تجميع دو لضبط المساحة المخصصة لعناصر بيانات المؤشر يمكنك القيام بذلك للحفاظ على التخزين إذا كنت تعرف أنك لن تعمل على جهاز 64 بت. يمكن استخدام بوكرز في التعبيرات الشرطية حيث كاليفورنيا n مقارنة مع بعضها البعض أو بالقيمة نول يجب أن تكون المقارنة التي تتضمن مؤشر إما مساويا أو لا تساوي أكبر وأقل من المقارنات غير مسموح بها. المستوى 01 ومستوى 77 عناصر البيانات التي هي عناصر بوينتر تتم مزامنتها تلقائيا إلى آلة مناسبة ، بغض النظر عن أي إعدادات تجميع الوقت هذا يسمح لك لتمرير هذه العناصر بأمان إلى سوبروتينس C دون الحاجة إلى القلق نفسك مع alignment. Except للمزامنة التلقائية، يتم التعامل مع عناصر بيانات أوسيج بوينتر في جميع النواحي مثل أوسيج أونسيغند-لونغ عناصر البيانات هذا يعالج جميع الآلات الحالية بشكل صحيح قد يتغير هذا السلوك لتلبية متطلبات بعض الجهاز في المستقبل. يتم تخزين عناصر البيانات نقطة الإغلاق في شكل تعتمد على الجهاز أوسيج فلوت البنود لديها 4 بايت المخصصة لهم استخدام عناصر مزدوجة تحتل 8 بايت. المستوى 01 ومستوى 77 عناصر البيانات التي تستخدم أوت فلوت أو دوبل تتم مزامنتها تلقائيا إلى حدود الجهاز المناسبة، بغض النظر عن أي وقت تجميع سيتينغس هذا يسمح لك لتمرير هذه العناصر بأمان إلى سوبروتينس C دون الحاجة إلى القلق نفسك مع المحاذاة. أن تعريف أنسي من كوبول لا يحدد كيفية تخزين العلامات في الحقول الرقمية باستثناء حالة سيبارات أكوكوبول-غ يتيح لك تحديد اتفاقيات تخزين التوقيع البديلة باستخدام خيارات تجميع الوقت - Dca و - Dcb و - Dci و - Dcm و - Dcn و - Dcr و - Dcv تحديد اتفاقية تخزين الإشارات مفيدة أحيانا عند تصدير واستيراد البيانات ل معلومات إضافية، راجع دليل المستخدم، القسم 2 2 10، خيارات تخزين البيانات. تؤثر اتفاقية التخزين على كيفية ظهور البيانات في أنواع بيانات أوساج ديسبلاي و كومب-2 و كومب-3 في أوسيج ديسبلاي، تخزين أسي القياسي، إذا كانت العلامة في الرقم، يتم ترميز الرقم وفقا للجدول التالي. إدخالات الجدول التي تحمل علامة النجمة تشير إلى عناصر ذات حجم ثابت عنصر بالحجم الثابت هو نفس الحجم بغض النظر عن الجهاز المستهدف إن الإدخالات بدون علامة النجمة متغيرة في سيز ستشغل هذه العناصر مساحة تصل إلى عدد وحدات البايت المدرجة في الجدول. ملاحظة الأحجام المدرجة في الجدول أعلاه تغطي جميع الآلات الحالية والمتوقعة التي تعمل أكوكوبول-غ قد تتطلب معماريات المستقبل تغييرات على الحجم الأقصى المخصص لهذه العناصر. في بيئة التنفيذ، تعمل هذه العناصر في جميع الطرق كما لو كانت عناصر بيانات ذات حجم ثابت من الحجم المناسب. على سبيل المثال، شفر التعليمات البرمجية التالية. طباعة 4 عند تشغيل على جهاز 32 بت، ولكن سيتم طباعة 8 عند تشغيل على جهاز 64 بت. في الأمثلة التالية، يتم تمثيل كل بايت من قبل اثنين من الأرقام السداسية العشرية أو من قبل حرف واحد نقلت يتم عرض كل قيمة في أشكال مختلفة كما هو عرض أوسب استخدام ديسبلاي باستخدام خيارات سيغن مختلفة تستخدم الأمثلة التالية اتفاقيات تخزين أكوكوبول-غ الافتراضية. عناصر بيانات هاندل تشكل فئة البيانات الخاصة بها وفئة في كوبول يتم تخزينها داخليا كقيم صحيحة، وتتصرف مثل الأرقام عند استخدام عنصر بيانات A هاندل يستخدم عادة إلى تخزين مقبض كائن تم إنشاؤه بشكل حيوي مثل نافذة عائمة أو عنصر تحكم رسومية. عناصر البيانات هاندل تأتي في شكلين مكتوب وعام يمكنك إنشاء مقبض عام عند حذف عبارة أوف يمكنك إنشاء مقبض كتبته عند تضمين العبارة أوف . يمكنك استخدام عناصر بيانات هاندل فقط عندما يسمح صراحة أو كجزء من عبارة موف أو عبارة كال كمعلمة أو في تعبير منطقي. يمكن استخدام مقابض جينريك في أي حالة حيث يسمح بالمقابض عند استخدام عام التعامل كمصدر لبيان موديفي، لن تكون قادرا على استخدام أي خاصية عنصر تحكم خاص أو أسماء أنماط في ذلك البيان لأن هذا المقبض العام يمكن أن يكون مقترنا بأي نوع من التحكم في هذه الحالة، لا يستطيع المحول البرمجي تحديد أي مجموعة من أسماء الاسلوب والممتلكات صالحة. يمكن استخدام مقابض مختلفة في البيانات حيث يسمح بأي مقبض، أو عندما كنت تشير إلى كائن من نوع مطابقة على سبيل المثال، لا يمكن استخدام مقبض نافذة باسم التعامل مع عبارة لابيل ديسبلاي بدلا من ذلك، يجب عليك استخدام مقبض عام أو مقابض هاندل أوف لابيل التي تم كتابتها تسمح للمترجم بالاعتراف بأسماء الأنماط والممتلكات المقترنة بها عندما تكون ملائمة مقابض الكتابة أيضا تحسين إمكانية قراءة البرنامج من خلال توفير معلومات إضافية حول المقصود استخدام مقبض، بالإضافة إلى توفير تجميع الوقت فحص للتأكد من أنك تستخدم مقابض في الحالات المناسبة. المقابض يمكن استخدامها في مقارنات هناك فقط مقارنات ذات مغزى التحقق من المساواة أو عدم المساواة إلى نول، ومقارنة مقبض آخر عنصر البيانات قيمة مقبض نول دائما يشير إلى مقبض غير صالح. المخازن يتم تخزين داخليا كما 4-بايت الأعداد الصحيحة الثنائية هذه المعلومات يمكن أن تكون مفيدة عند تصحيح برنامج يمكنك فحص قيم المقابض في المصحح يجب أن لا تعتمد على هذا تعريف في البرنامج الخاص بك، ومع ذلك، لأنه يخضع للتغيير في المستقبل. البنود بيانات هاندل تلقائيا سينكرو نيزد على حدود 4 بايت لاحظ أن هذا يحدث بغض النظر عن إعداد الخيار - Dl تجميع الوقت الذي يحد من كمية التزامن نظام التشغيل يتطلب هذا المستوى من المحاذاة لتجنب توليد أخطاء حافلة على بعض الآلات. إذا كان اسم الخط ، ثم يتم تهيئة عنصر البيانات الموصوف بواسطة بند أوسيج عند بدء تشغيل البرنامج مع مقبض الخط المقابل يعمل هذا بشكل مماثل لوضع العبارة. أ بداية البرنامج حيث يكون بند البيانات عنصر البيانات الموصوف في بند أوسيج و فونت-نيم هو نفس اسم الخط في جملة أوسيج. قراءة تنسيقات كوبول. تم كتابة هذا البرنامج التعليمي حول كيفية قراءة تخطيط كوبول خصيصا لعملائنا الذين أجروا تحويلا في ديسك إنتيرتشانج وتلقوا تخطيط كوبول مع البيانات ويهدف إلى إعطائك ما يكفي من المعلومات لقراءة تخطيطات أبسط أنها لا تغطي جميع المواضيع أو كل شيء سوف تجد في تخطيط معقد، ويهدف إلى شرح كوبول لا يوت فقط حتى تتمكن من استخدام البيانات التي تم تحويلها، وليس حتى تتمكن من كتابة برامج كوبول. هذه المقالة تبدأ هنا قراءة كوبول تخطيطات حيث ستجد أيضا فهرس الموضوع. الجزء 4 الحقول الرقمية. هذا القسم يصف العديد من أنواع البيانات الرقمية والتعامل مع علامات ونقاط عشرية. المحتويات من هذا المقطع. تحويل حقول رقمية أن أعمالنا. كوبول لديها عدة أنواع من الحقول الرقمية وتشمل أنواع البيانات هذه حقل ديسبلاي، الذي يتكون من أحرف إبكديك أو أسي الأحرف 0-9، حقول ثنائية وحقول معبأة وحقول نقطة عائمة هناك أيضا خيارات لعلامة منفصلة أو - أو علامة فوقية، وبالنسبة لعشرية حقيقية أو ضمنية يتم تحديد نوع البيانات بواسطة بند أوسيج إس. The أوساج إس Clause. There هو في الواقع أكثر إلى بيان الصورة مما سبق وصفه هناك عبارة أوسيج إس التي تحدد نوع تخزين حقل رقمي - عرض أو ثنائي أو حسابية بناء الجملة الكامل، عبر مثال، هذا يقول لتخزين ه الحقل في الشكل الحسابي 3 الاستخدام هو جزء اختياري وعموما توقفت، ويمكن اختصار كومبوتاتيونال كومب، لذلك سوف ترى أكثر شيوعا هذا مكتوب أنواع الحقول الرقمية سوف تشاهد عادة في تخطيطات كوبول هي. عرض بما في ذلك الحقول الحقلية، أو كومب. العرض، بما في ذلك الحقول الموقعة أو المخصصة، هو الأكثر شيوعا، و كومب-3 هو النوع الثاني الأكثر شيوعا للحقل الرقمي قد يكون لدى بعض المبرمجين أيضا أنواع بيانات كومب-4 و كومب-5، عادة إلى محاكاة كومب على مترجم آخر. الاستخدام هو العرض. تنسيق العرض هو الافتراضي للأرقام في كوبول إذا لم يتم تحديد استخدام شرط، الافتراضي هو استخدام العرض، وهو ما يعني يتم تخزين القيمة كأرقام إبكديك أرقام، على عكس ثنائي و قد تكون أو لا يكون لها عشرية - ضمنية أو حقيقية - وقد تكون غير موقعة أو تحتوي على علامة مضمن أو علامة منفصلة - والتي يمكن أن تكون إما رائدة أو زائدة يحتوي حقل تنسيق العرض الموقوف الافتراضي على علامة زائدة مدمجة، شارك ممونلي يسمى توقيع أو عب سيغنيد أو حقل زوند يتم وصف هذا النوع من البيانات أدناه. الحقول المسجلة. هناك نوع بيانات رقمي شائع يستخدم في كوبول على عب مينفرامس يسمى سيغند ويسمى أيضا عب سيغنيد أو يمثل كوبوند زونيد هذا النوع من الحقول بواسطة S في شرط الصورة في حقل تنسيق العرض، على سبيل المثال بيك S9 6 A يتكون الحقل الموقَّع من أحرف رقمية إبكديك عادية، وحرف واحد لكل بايت، لجميع الأرقام باستثناء الرقم الذي يحمل علامة، إما علامة الأكثر أهمية الرقم الرئيسي أو الأقل أهمية علامة زائدة - عادة أقل رقم هام الرقم الذي يحمل علامة يجمع، أو أكثر لكمة علامة على الرقم على هذا الرقم هذا يحفظ بايت واحد أن علامة ستشغل خلاف ذلك قيمة ذلك يتم تخزين الرقم كقيمة ثنائية، و أور d مع رمز التوقيع، وهو عرافة D0 للأرقام السالبة، عرافة C0 للقيم الإيجابية، والعرافة F0 للقيم غير الموقعة. بسبب أوفيربونش، فإن الرقم الذي يحمل علامة سوف لا تظهر ك رقم عندما يتم عرض الحقل في وضع الأحرف إبكديك إذا كان لديك الحقل وعرض قيمة 1 23 مع محرر إبكديك، فإنه سيتم قراءة 0000012C. ASCII المجمعين كوبول أيضا استخدام نوع بيانات موقعة مع أوفيربونش، ولكن بت علامة هي مختلفة وغير موحدة بين المجمعين انظر لدينا تيش-تالك موجز وقعت الحقول لمزيد من التفاصيل على كل من إبكديك و أسي الحقول وقعت. الاسم هو منفصل. كوبول وقعت الحقول تضمين علامة في القيمة افتراضيا انظر الحقول وقعت أعلاه ولكن هناك حكم في كوبول لعلامة منفصلة، ​​ويمكن أن تكون إما الرائدة أو زائدة بيان لهذا هو قد يتم دمج هذا مع الشرط الرئيسي أو زائدة يمكن تطبيق هذا البيان على حقل بند أساسي أو إلى كامل السجلات و بيناري Field. Because أجهزة الكمبيوتر إجراء الحسابات مع الأرقام الثنائية، فمن أكثر كفاءة لتخزين تلك القيم في الملف في شكل ثنائي الأصلي من لتخزينها في قاعدة للقراءة البشرية عشرة إذا تم تخزين الرقم في نات نسق ثنائي يمكن أن يكون الإدخال من الملف واستخدامها مباشرة إذا كان تخزينها في شكل قاعدة عشرة يحتاج إلى تحويلها إلى ثنائي قبل إجراء العمليات الحسابية على ذلك، ثم تحويلها مرة أخرى إلى قاعدة عشرة للتخزين. كوبول يحدد العديد من أنواع البيانات الثنائية سنقوم بإدراج ملخص مختصر هنا، ويمكنك العثور على مزيد من التفاصيل في حقول كوبول الحسابية وفي حقول كوبول كومب-3 معبأة قبل أن نبدأ، هناك نقطة هامة واحدة لفهم معيار كوبول يترك التنفيذ الفعلي لمعظم أنواع البيانات تصل إلى البائع الذي كتب مترجم كوبول والسبب في ذلك هو لأن أجهزة الكمبيوتر المختلفة - وحدات المعالجة المركزية - استخدام تمثيلات ثنائية مختلفة داخليا، وتعمل بشكل أفضل مع نوع الخاصة بهم من الأرقام الثنائية هذا النهج يؤدي إلى أفضل وأسرع المجمعين، ولكن أيضا يسبب الارتباك، لأن نوع بيانات كومب على جهاز واحد ليس بالضرورة نفس كومب على جهاز آخر الجدول أدناه يسرد الاستخدامات الشائعة ليس كل المجمعين سوف يتبعون هذه الأنواع لمزيد من ديتا إلس على ترتيب الكلمات وعلامات رؤية الرابط أعلاه. ويحدد نوع البيانات التي يستخدمها الحقل للتخزين من قبل استخدام شرط في تعريف الحقل، وفي معظم الحالات يتم تحديد عدد وحدات البايت من التخزين عن طريق عدد من الأرقام في بيك تتبع أرقام النقطة العائمة التنسيقات الثنائية القياسية، وبالتالي لا يتم تحديد أحجامها بواسطة الموافقة المسبقة عن علم، ولا يتم استخدام بيك في تعريف الحقل. وصف كيفية تخزين نوع البيانات هذا. -3.عندما تقرأ مواصفات حقل ثنائي أو كومب، فإن الحجم المدرج في الموافقة المسبقة عن علم هو عدد الأرقام العشرية بعد تحويل الرقم من ثنائي إلى قاعدة عشرة في حالة حقل معبأ، فإنه s الحجم بعد تفريغ. العشرية. أغلب مبرمجي الكمبيوتر يميلون إلى التفكير من حيث العشرية الحقيقية في القيم الرقمية على جهاز كمبيوتر، إذا كان لديك حقل دولار وسنت ل، مثلا، الفاتورة الإجمالية، في مبلغ 123 45، فإن الملف يحتوي على ستة بايت 123 45 وربما علامة بعبارة أخرى، هناك نقطة عشرية حقيقية في ملف كوبول يمكن القيام بذلك أيضا عن طريق ما يلي أو وجود في الموافقة المسبقة عن علم يسبب عشري حقيقي في الملف العشرية ضمنية، ومع ذلك، هو أكثر شيوعا بكثير في عشرية كوبول. Implied. Implied عشري ببساطة يعني وجود نقطة عشرية ضمنية في موقع محدد في حقل ولكن لا يتم تخزينها فعليا في الملف يشير موقع العشرية الضمنية بواسطة V في بيك باستخدام مساحة الحفظ العشرية الضمنية في الملف يمكن أن ينطبق العشرية الضمنية على أي نوع من الحقل الرقمي، بما في ذلك حقل معبأ أو كومب-3.على سبيل المثال، حقل عشري ضمني هناك 6 أرقام، ثم عشري ضمني - رقم V - ورقمين إضافيين، ليصبح المجموع 8 أرقام. 8 بايت في الحجم ليس هناك في الملف - يعني موقع النقطة العشرية أن يكون بين 9 6 و 99 إذا كان الحقل يحتوي على 00000123 ثم رصيد الحساب هو 1 23، لأن هناك عشري ضمنية بين دولار و سنتس. التزامن و محاذاة. هذا الموضوع هو ولكن يجب أن تكون على علم بذلك عند استخدام ثنائي ثنائي التخزين و كومب، قد يتطلب بعض المجمعين على بعض الأجهزة أن يبدأ حقل رقمي على بعض الحدود على سبيل المثال، على جهاز 32 بت، قد تتطلب ذلك بدء حقل كومب على حدود 32 بت. إذا قمت بتحديد حقل كومب في منتصف السجل، وأنه لا يحدث أن تبدأ على 32 بت 4 بايت الحدود، فإن المحول البرمجي محاذاة إلى حد 32 بت لمزامنة ذلك ما في الواقع المخزنة في ملف قد لا يكون نفس بيكس على تخطيط تشير هذه ليست مشكلة شائعة جدا، ويرجع ذلك جزئيا إلى المجالات الثنائية و كومب ليست شائعة جدا في الملفات، ولكن يجب أن تكون على علم بها. إضافة للحصول على المزيد من المقالات حول تحويل البيانات، راجع تيشتالك index. Our كوبول كونفيرزيون Services. Disc إنتيرتشانج سيرفيس كومباني يمكن تحويل معظم أنواع البيانات الرقمية، بما في ذلك جميع أنواع البيانات عب إيبكديك المركزية، ومعظم أنواع البيانات أسي من أجهزة الكمبيوتر وأنظمة أونيكس لدينا بسبب، كونف رسيون الروتينية يسمح لنا للتعامل مع تلك الوظائف الصعبة التي يمكن أن المبرمجين كوبول القياسية t تحويل. الشرط هو قطعة خاصة من التعليمات البرمجية التي تسمح لك لإرشاد الكمبيوتر لمقارنة قطعتين من البيانات يتم استخدام الشروط في إف البيانات وفي الفقرات حتى في حين من بيان الأداء. التوصيات لديها سينتاكس. حيث البيانات 1 و البيانات 2 يمكن أن تكون حرفية أو حقل البيانات 2 يمكن أيضا أن تكون كوبول الحرفية مثل سباسس أو ZEROS. Operator يمكن أن تكون رموز المقارنة التقليدية للتحقق من استخدام عدم المساواة ليس نظرا لعدم قبول جميع المترجمين الرمز نادرا، لن يقبل مترجم يمكنك استخدام نوت وليس العودة إلى جدول المحتويات. يمكن أن تستمر البيانات على عدة أسطر دون القيام بأي شيء أكثر من وضع التعليمات البرمجية على أسطر منفصلة سوف مترجم الرقم بها. يمكن أن تستمر طويلة جدا الأحرف الأبجدية الرقمية على خطوط متعددة عن طريق وضع واصلة في العمود 7 من خطوط استمرار ووضع ما تبقى من الحرفية هناك هذا استمرار لايت رال يتطلب بداية اقتباس واحد الحرفي على السطر السابق ليس لديه اقتباس واحد تنتهي ولكن يعتبر لتمتد إلى العمود 72. الواصلة على السطر 2 في العمود 7 الاقتباس واحد على هذا الخط في العمود 12 و الحرفية لا تزال من هناك مطلوب اقتباس واحد نهاية على هذا الخط لاحظ أن جزء من الحرفي أن s في السطر الأول ليس لديها اقتباس النهاية إذا كان آخر E ليس في العمود 72 ثم سيتم افتراض أن جميع الأحرف بين أن E والعمود 72 هي مساحات وسوف تظهر في الحرفية. أيضا صالحة مع قيمة clauses. Control Diss. Control فواصل هي سمة من سمات التقارير التي تسمح لتجميع وتراكم المجاميع الفرعية للبيانات التي تنتمي معا على أساس قيمة حقل حقل التحكم عندما تتغير قيمة هذا الحقل من سجل واحد إلى آخر فواصل البرنامج للقيام ببعض المعالجة الخاصة مثل الطباعة المجاميع الفرعية قبل أن يستمر مع السجل التالي يجب أن يتم فرز ملف الإدخال على c حقل أونترول s. على سبيل المثال تقرير يحتوي على فاصل تحكم بمستوى واحد. كسر التحكم موجود على القسم كل قسم من مجموعات التحكم لديه عناوينه الخاصة ومعدلاته الإجمالية على الرغم من أنه لا يظهر هنا في هذا المثال فإنه شائع لعناوين الأعمدة لتكرارها بعد كل عنصر تحكم. انظر صفحة الخوارزميات لعينة التعليمات البرمجية. هناك أساسا ثلاثة أنواع من البيانات المعترف بها من قبل البيانات الرقمية كوبول سواء مع أو بدون المنازل العشرية فقط 0-9، العشرية و علامة يسمح، أبجدي فقط الأحرف أز و أبجدية رقمية أي أحرف نادرا ما تستخدم الحروف الأبجدية. يمكن أن يتم تنفيذها فقط على الحقول الرقمية. البيانات هي البيانات الشائعة لبرامج كوبول ويجب التلاعب بها في كثير من الأحيان يتم تخزين التواريخ عادة في شكل غريغوري، تتكون من شهر مألوفة واليوم والسنة ويسمى هذا عادة شكل ممدي، على الرغم من شكل ممديي أصبح المعيار الجديد انظر صفحة المناقشة Y2K في حين أن هذه الأشكال مألوفة للمرمزين والمستخدمين التواريخ هي مور غالبا ما يتم تخزينها في تنسيق ييمد أو ييمد بحيث يمكن فرزها بسهولة. فهو ما يسمى تقويم الرياضيات، حيث يتم استخدام التواريخ في العمليات الحسابية، يمكن أن تكون عملية شاقة، إلا إذا كان مترجم الخاص بك يدعم وظائف تاريخ جوهرية إذا لم يكن، وتذكر ما يلي حول والتقويم الغريغوري. أبريل، يونيو وسبتمبر ونوفمبر فقط 30 يوما. في فبراير فقط 28 يوما، 29 إذا كان العام قفزة. جميع الشهور الأخرى لديها 31 يوما. الطريقة الرسمية لتحديد ما إذا كان العام هو سنة كبيسة يتطلب تقسيم 4 أرقام سنة من 4، 100 و 400 و النظر في بقايا تلك الحسابات الثلاثة إذا كان أول ريمياندر هو 0 ثم السنة هي سنة كبيسة، ولكن إذا كان الباقي الثاني هو أيضا 0 ثم السنة ليست سنة كبيسة، ولكن إذا كان الباقي الثالث هو أيضا 0 ثم السنة هو سنة كبيسة مرة أخرى هذا هو السبب في عام 2000 هو سنة كبيسة بحلول عام 1900 و 2100 ليست هذه الشيكات يجب أن تكون متداخلة داخل بعضها البعض، في محاولة لوضعها في إف واحد لن يتم استخدام. Dimimiters كما ينتهي البصرية لبيان يفعلون نت ولكن لا تجعل التعليمات البرمجية أسهل للقراءة والحفاظ على مثال على محدد هو إند-IF. Verbs التي لها نهاية محددات هي الأفعال المقارنة إف، إيفالويت، إخراج الإدخال قراءة، كتابة، حذف، إعادة، قبول، الرياضيات أد، سوبتراكت، مولتيبلي، ديفيد، كومبوت، معالجة نقل الأداء، كال وبعض الأفعال الأخرى الأقل استخداما. عندما يواجه مترجم الفترة التي يستغرقها كما نهاية البيان A المحدد الذي يتم العثور عليه بعد فترة في خطأ. أ حقل ما لغات أخرى استدعاء متغير أنه مكان لتخزين البيانات يجب أن يتم الإعلان عن جميع الحقول في قسم البيانات يحتوي إعلان الحقل ثلاثة أجزاء رقم مستوى اسم الحقل وفقرة الموافقة المسبقة عن علم شرط فالو اختيارية. اسم حقل صالح هو من 1 إلى 30 حرفا في الطول يحتوي فقط على الحروف أز والأرقام 0-9 والواصلة يحتوي على حرف واحد على الأقل لا تبدأ أو تنتهي بواصلة وليس كلمة كوبول محفوظة. هذه هي الحرفية الرقمية الخاصة الكامنة في كوبول عالية - VALUES هو كوبول تعادل ما لا نهاية - لا يوجد عدد أكبر من هاي-فالويس على العكس من ذلك، لا يوجد عدد أقل من لو-VALUES. Julian التواريخ. جوليان هو تنسيق التاريخ الذي بديلا عن التواريخ الميلادية وهو يتألف من يوم 3 أرقام و السنة لا توجد أشهر أيام تتراوح من 1 يناير 1 إلى إما 365 أو 366 ديسمبر 31، اعتمادا على إذا كان العام هو سنة كبيسة أم لا وهذا هو المعروف عموما بتنسيق ددي أو دديي، على الرغم من أن عادة يتم تخزين التاريخ كما ييد أو ييد لتخفيف مع الفرز. المحلات التي تجعل من مواعيد جوليان سيكون لها إجراءات قابلة للاستدعاء التي سرية جوليان إلى الميلادي والعودة مرة أخرى، لأن البشر هي مريحة مع التواريخ الغريغورية وظائف تاريخ الجوهرية المتاحة مع أحدث المبردات كوبول لديها هذه التحويلات المدمج في. Julian format has two advantages First, it s smaller, so it takes up less space Second, it eases with some calculations because it contains no months For example, how many days are between Feb 5, 1997 and Nov 28, 1999 Convert to Julian 19970 36 and 1999332 a quick subtraction gives 1026 days Remember that borrowing a year gives you 365 days. Getting a future date or past date can also be easier with Julian What date is 45 days before Apr 15, 1999 Convert it to Julian 1999105 , subtract 45 to get 1999060 and convert back to Gregorian Mar 1, 1999.Level Numbers. Level numbers are used to group fields in the Data Division A field can then be defined as a collection of other fields The higher the level number the lower in the heirarchy the field is Normally, the field numbers 01, 05, 10, etc are used By spacing them out you leave yourself room in case a level needs to be added later Valid level numbers are 0-49.Each FD is required to have an 01-level field defined This is the record definition It can be broken down into smaller fields if desired For example. We have an 01-level field that is broken down into 4 fields the 05-level fields Two of the 05-level fields are also broken down Employee number is an elementary field because it is not broken down into smaller fields The employee name and birth date are group level fields because they are broken down into smaller fields Only elementary fields have PIC clauses. The birth date is 8 characters long the sum of the lengths of the elementary fields that compose it All 8 characters can be accessed with one name IN-BIRTH-DATE or one of its pieces can be accessed by using that name instead i e IN-BIRTH-MM. A group level item ends when another field with the same level number, or one with a lower value, is encountered For example, the list of fields within IN-BIRTH-YEAR ends when the 05-level IN-DEPARTMENT is encountered A field of level 10 would also have ended it. All group level fields are considered to be alphanumeric. All of these level number concepts are valid for WORKING-STORAGE also. Literals are specific values as opposed to fields Alphanumeric literals are enclosed in single quotes In the following statements.3 1415927 is a numeric literal and Enter a number is an alphanumeric literal COBOL has some built-in literals like ZEROES and SPACES. A paragraph is a section of COBOL code Paragraph names start in the A margin and follow the same naming rules that fields do A paragraph ends when another paragraph name is encountered Paragraphs can be executed with the PERFORM statement. You can think of a pargraph as the equivalent of a subroutine in other languages There are no arguments, all fields are thought of as global. PIC Clauses. PIC short for PICture clauses describe the size and type of data for each field Numeric data has a PIC character of 9, alphanumeric data uses X and alphabetic data an A Each 9, X or A represents one character Length can also be represented by a repetition factor The PIC clauses 9999 and 9 04 both define 4-digit numbers. The PIC character V is used to mark where a decimal point is If you had a 8-digit numeric field but 2 of the digits are after the decimal point, you would define it as PIC 9 06 V99 The decimal point is impl ied, it is not physically there in the data It also takes up no space To allow for a field to hold either positive or negative numbers precede the leftmost PIC character with an S PIC S999V99.There are several output PIC characters which help with formatting data for display or print Numeric fields are MOVEd to fields defined with these formatting PIC characters Fields defined with these formatting PIC characters are considered alphanumeric No calculations can be done with these fields Newer versions of COBOL allow these fields to be MOVEd to straight numeric fields. To print a decimal point place a in the desired place in the output PIC clause i e PIC 999 99 You can place commas in output numbers also i e PIC 999,999 99 In this manner the decimal point and commas do take up space These are considered insertion characters - they insert themselves into the data Other insertion characters are B for a space , 0 a zero and useful in printing dates. There is Z, for suppressing leading zeroes If the digit represented by a Z is a leading zero it will print as a blank You normally have one 9 in the PIC clause, in the one s place All other digits represented by Z s Do not use Z s after the decimal point If used with commas i e PIC ZZZ, ZZ9 99 a comma will only print if the character to its left prints, else it prints as a blank. There are other zero suppression characters A can be used just like the Z except that rightmost leading zero will print as a and all zeroes to the left of that will print as spaces So the value of 125 00 MOVEd to a PIC , 9 99 will print as 125 00 This behavior of the is called floating An will work the same way for check protection but all print, not just the one to the left of the most significant digit When either the floating or the is used in conjunction with commas the comma will only print as a comma if the character to its left prints as a digit Depending on the situation it will otherwise print as a blank, or. For sign control you can use or - as an output PIC character A will print for positive numbers and - for negative numbers A - will print a - for negative numbers and a blank for positive numbers Either can be repeated to suppress leading zeroes like the and can float also like the Alternatively, a or - can be placed to the right of the number. For accounting purposes the PIC characters DB and CR can also be used i e PIC , 9 99DB The DB or CR will only show if the value is negative If positive they will print blanks. Qualified Fields. It is legal in COBOL for different fields to have the same name These fields cannot be 01-level fields and cannot be part of the same group-level field. When referencing one of these fields the compiler requires the field to be qualified, meaning its group-level field must be specified If both INPUT-RECORD and OUTPUT-RECORD contained a field named PAY-RATE then in code you cannot simply reference PAY-RATE, it would have to either be PAY-RATE OF INPUT-RECORD or PAY-RATE OF OUTPUT-RECORD. Reference Modification. Reference modification allows for the referencing of a portion of a field without having to make it a group-level field and defining each portion of the field that will be accessed. If you wanted to check the value of the 4th through 6th characters of a field to see if they were equal to ABC you can code. The first number in the parenthesis represents the start position in the field and the second number represents the length Both values have to be specified COBOL treats all such references as alphanumeric. Since this is not a self-documenting feature it should not be used carelessly. A report is simply a formatted representation of data, suitable for being printed on paper hardcopy Reports generically look like. The first two lines are page headings, which will appear on every page The next printed line following the blank line is column headings It s common for column heading lines to be printed on every page Next come the detail lines - typically one per record At the end of the report will be a total line if you are totalling anything Note that the first detail line is the 6th line printed on a page must count the blank lines also. There are other types of lines that can appear on reports Sometimes there are page footings printed on the bottom of each page There can also be report headings and report footings only printed at the top and bottom of the report as opposed to each page. Note the formatting of the data There are commas and leading zeroes are suppressed on page numbers and monetary figures The date has slashes Always make reports as easy to read as possible. See the algorithms page for sample code. A section is a group of paragraphs The section name must begin in the A margin and be followed by the word SECTION Naming standards for sections are the same as those for paragraphs A section ends when a new one begins. A section can be PERFORMed in the same manner a paragraph is PERFORMed The PERFORM only uses the section name, there is no reference to i t actually being a section instead of a paragraph. Subscripts and Indexes. Subscripts and indexes are the two tools used to reference individual elements of a table A subscript is a working-storage field defined separately from the table and is completely available to the programmer An index is created automatically by the system if it is directed to do so and only has limited availability to the programmer. An index cannot be part of a calculation, cannot be MOVEd to another field or cannot receive another field from a MOVE and it cannot be DISPLAYed To manipulate an index the SET statement must be used. The major difference between a subscript and an index is that a subscript is a position in the table first element, 20th element, etc An index is a byte offset of an element relative to the beginning of the table Since the first element is 0 bytes away from the start of the table, it has an index of 0 The 20th element say each element is a PIC X 5 starts 95 bytes from the start of the tab le so its index is 95 When manipulating an index the programmer does not do so by this byte offset It is done by position in the table and the translation to byte offset is done internally by COBOL. See the algorithms page for sample code on loading and searching tables. Tables are the COBOL equivalent to arrays It is a set of fields with the same name and the same data type To reference an individual element of the table a subscript or index must be used. Tables are defined using the OCCURS clause. See the algorithms page for sample code on loading and searching tables. Truncation is a phenomenon that occurs when the receiving field of a MOVE or a math operation is not big enough to hold what it s getting For alphanumeric fields truncation happens on the right move COBOL to a PIC X 4 and you get COBO and numeric it happens on the left move 1000005 to a PIC 9 06 and you get 5 No warnings, no messages Just the loss of data.77-level Fields. A working storage field can be declared with a level number of 77 The 77 must be in column 8, the field cannot be a group-level field and the field cannot be part of a group-level field.88-level Fields. A field declared with a level number of 88 is commonly known as a condition name This name can be used anywhere a condition can be used and is generally more readable Condition names are declared immediately after the field they are associated with They use no storage they take up no room. For example your application contains a field named ACCT-TYPE which is PIC 999 One particular section of code determines if the account is a checking account account type 100, 110, 210 or 300 , a savings account type 150 or 175 or a CD IRA type 400 An IF statement could look like. Logically accurate but not entirely clear what account types are what Comments would help, but condition names will help more Define as. The same IF can now look like. Now it s self-documenting The added advantage is if another type of savings account is developed it only needs add ed at the condition name The IF statement doesn t change. A specific value can appear in multiple condition names Values associated with a condition name can be specified with THRU i e VALUES 90 THRU 99 When checking condition names NOT can be used If a condition name only has one value a statement such as SET CD-IRA-ACCT TO TRUE is valid and is the equivalent to MOVE 400 TO WS-ACCT-TYPE. The ACCEPT statement is used to get information from a source other than a data file like the keyboard or CPU clock. will cause the program to wait until the enter key is pressed Any data typed in before the enter key is pressed will then be placed in field See How do I for issues with getting numeric data in this manner See the algorithms page for sample code on receiving and processing data received interactively. The ACCEPT statement can also be used to get information from the system clock such as the current date and time. field-1 is PIC 9 6 The date will be in yymmdd format. field-2 is PIC 9 8 The tim e will be in hhmmsscc format where cc is hundredths of a second hh will be in military time 0-23.field-3 is PIC 9 3 The value will represent the current Julian date, which is a number from 1-366 representing the date as a number of days relative to the end of the previous year Jan 1st 1, Feb 1st 32, etc. field-4 is PIC 9 The values range from 1 Monday to 7 Sunday. The basic form of the ADD statement is. which adds value either a literal or a field to field-1 and stores the result in field-1 A list of fields can follow the TO which will add the value to each of them A list of values can be before the TO which would add all of them to field-1.It is possible to add two values either literals or fields and store the result in a separate field with the GIVING clause. Blank When Zero. BLANK WHEN ZERO can be specified with a PIC clause so that blanks are printed if the value of the field is zero For example, PIC -,--9 99 BLANK WHEN ZERO. The CALL statement is used to call another program As long as the called program contains a GOBACK or EXIT PROGRAM then when the called program finishes control returns to the calling program. Fields can be passed from the calling program to the called program These fields are in the calling program s WORKING-STORAGE SECTION and in the called program s LINKAGE SECTION The USING clause on the CALL specifies the fields to pass The called program lists these fields in the USING clause of the PROCEDURE DIVISION These fields don t have to have the same name in both programs, but the definitions must match. See the algorithms page for sample code on calling another program. The CLOSE statement will close an open file Attempting to close a closed file will produce a run-time error. One CLOSE statement can close multiple filesPUTE allows you to c ombine several math operations in one statement, using familiar symbols instead of English-like sentances. Expression is any valid mathematical expression involving literals fields and the following symbols COBOL has no recursion. Each of the examples can also be specified with a THRU option, allowing for a sequence of paragraphs to be executed. Paragraph-name-2 will also be executed. There is also what s known as an in-line perform where a block of code appears between a PERFORM and END-PERFORM No paragraph name is specified For example. When using the UNTIL option with a perform or in-line perform the UNTIL condition clause can be preceded by WITH TEST AFTER to have COBOL check the condition after the loop instead of before This will cause the loop to always be executed at least once This has the effect of a REPEAT-UNTIL loop of other languages. The read statement will read the next record from the specified file and place the data in the record layout of that file s FD The file must be al ready open as input Reading an unopend file or attempting to read beyond the end of a file will produce a run-time error The AT END clause is required. Optional clauses are NOT AT END and INTO NOT AT END specifies a statement to be executed if the read did not hit the end of the file INTO specifies a working-storage field into which the system will place the input record. The READ NEXT is used after a successful START to read records along the established access path The condition used by the START is not remembered by the READ NEXT so after each successful READ NEXT the record must be checked to see if it still matches whatever criteria the program is calling for A successful read only means that a record was retrieved. Since this is still a sequential process the READ NEXT requires an AT END clause The optional NOT AT END clause is supported. See the algortihms page for code examples. The REDEFINES clause allows you to have multiple field definitions for the same piece of storage The same data then can be referenced in multiple ways. Take a simple example, useful for data validation. This portion of the data division only consumes 8 bytes of storage, not 16 Each of the two PIC clauses is describing the same 8 bytes of data, just doing it differently. Once data is in WS-NUMBER-X it can be checked to see if it is numeric IF WS-NUMBER-X IS NUMERIC If so, WS-NUMBER can then be used as part of a calculation If the data happens to be non-numeric then this type of code will prevent the program from choking We access the data as alphanumeric any data allowed to see if it is safe to access it as numeric before actually attempting to do so. Note that once the data was moved to WS-NUMBER-X it was also moved to WS-NUMBER because they both describe the same portion of storage. There are a few rules with REDEFINES. A redefinition must have the same level number as the field it is redefining. The redefinition must immediately follow the field it is redefining i e if an 05-level field is bei ng redefined then the redefinition must be the next 05-level field. Cannot have a REDEFINES of an 01-level field in an FD. The redefinition should be the same size as the field it is redefining though not all compilers require this. It is possible to redefine at the group level though each group-level field does not have to the same number of elementary fields. Not all compilers allow VALUE with REDEFINES It s a bad idea in any case. Can have multiple REDEFINES of the same field. Back to Table of Contents. The RELEASE statment is required in an INPUT PROCEDURE of a SORT It is used to specify that a record is to be included in the sort. Only RELEASEd records will be sorted. See the algorithms page for sample code on using the SORT statement. The RETURN statment is required in an OUTPUT PROCEDURE of a SORT It is used to retrieve a record from the sort back into your program. The records are RETURNed in the sorted order. Like the READ statement the RETURN supports the NOT AT END and INTO optional cla uses Also like the READ, it is best if only one statement is used in either the AT END or NOT AT END clauses. See the algorithms page for sample code on the SORT statement. REWRITE will update the current record in a non-sequential file OPENed as I-O There must be a current record, so a successful READ or READ NEXT must precede the REWRITE Following the READ READ NEXT and before the REWRITE some information on the record will presumably be changed. REWRITE specifies the record, not the file. See the algorithms page for sample code on using non-sequential files. Rounded is a clause valid with any of the math verbs ADD SUBTRACT MULTIPLY DIVIDE COMPUTE Place it in the command after the name of the field that will receive the result. The search command is used to search a table for a particular entry The table must have an index see OCCURS The format is. The field is the field with the OCCURS clause WHEN specifies the condition on which to end the search usually when some field equals a table ent ry Only one statement can be specified in the WHEN but it can be a PERFORM The AT END clause is optional, specifying one statement to be executed if the entire table is searched without satisfying the WHEN condition It is recommended, however. There can be multiple WHENs but the search stops once the condition of a WHEN is satisfied To allow for multiple search matches use a PERFORM VARYING which can increment an index. If the table entries are sequenced by the field being searched then a binary search can be used instead Use SEARCH ALL instead of SEARCH It is more efficient than a regular search, especially with large tables The SEARCH ALL has some limitations. Only one WHEN is permitted. The WHEN condition can only test equality. The WHEN condition cannot contain an OR. The table field must be to the left of the in the condition. See the algorithms page for sample code on loading and searching tables. Set can be used to manipulate an index. Note that while an index is actually a byte offset w ithin a table COBOL does not expect you to work on that level Setting an index to 2 will cause it to point to the 2nd element in the table, regardless of its offset Likewise, seting an index up one will move it to the next element in the table, regardless of the size of the element COBOL will translate it to the proper offset for you. Set can also be used with condition names as an alternative to a MOVE Consider the following. It is then permissible to code. This is the equivalent to MOVE Y TO WS-END-OF-FILE-SW but it is more readable Most compilers will not allow a condition name with multiple values to be used in a SET It is not a good idea in any case. The sort statement is used to sort a file It requires a work file area that is defined in the FILE SECTION, just like any other file, except it is an SD instead of an FD The basic sort statement looks like. Multiple fields can be used in the sort, just list them in the desired order DESCENDING KEY can be specified instead of ASCENDING KEY DESCENDING KEY and ASCENDING KEY can be combined in the same statement. The SORT statement will open and close both the input and output files automatically The field s to be sorted on must be defined in the SD of the sort file. An INPUT PROCEDURE can be specified instead of an input file This allows the flexibility of selecting specific records to be sorted or to do other types of processing before the sort Likewise, an OUTPUT PROCEDURE can be used instead of an output file An INPUT PROCEDURE requires a RELEASE statement and an OUTPUT PROCEDURE requires a RETURN statement For example. This statement will execute paragraph-1 perform the sort and then execute paragraph-2 An INPUT PROCEDURE can be used with GIVING and an OUTPUT PROCEDURE can be used with USING Each of these options allows the THRU option i e paragraph-a THRU paragraph-b. The clause WITH DUPLICATES IN ORDER can be included in the statement after the last ASCENDING DESCENDING KEY This will cause any records with the same value s for the sort field s to be kept in their original order Not specifying this will not necessarily change their original order, but there is no guarantee. See the algorithms page for sample code on using the SORT statement. The Start statement is used to establish an access path for an indexed file with alternate keys see the algortihms page for code examples Note that keys in alternate indexes are not necessarily unique and the START is used in conjunction with the READ NEXT statement to find and retrieve and these records. The alternate key field must already be populated with a value. The first record in the file with that value for the alternate key is read It is a good idea to include a INVALID KEY clause in any START to handle the case where there is no record in the file with the appropriate alternate key. Instead of EQUALS the START also supports and NOT or NOT Back to Table of Contents. The stop run statement will cause a normal termination to your program. The STRING is used to con catenate join multiple fields or literals into one field It replaces a series of MOVEs For example. After the above statement is executed WS-DISPLAY-DATE will contain 12 24 2000 DELIMITED BY SPACE means to use as much of that field or literal that appears before the first space If there are no spaces like in the example then the entire field or literal is used Any character can be used in the DELIMITED BY clause. Literals are usually DELIMTED BY SIZE, meaning to use the whole thing. The DELIMITED BY character is never included in the combined field. The basic form of the subtract statement is. which subtracts value either a literal or a field from field-1 and stores the result in field-1 A list of fields can follow the FROM which will subtract the value from each of them A list of values can be before the FROM which would subtract all of them from field-1.It is possible to store the result in a separate field with the GIVING clause. The UNSTRING is used to split a field into multiple fields using a particular character to determine where to split the field For example. The above statement will take the all of WHOLE-NAME, up to but not including the 1st space, and place it into WS-FIRST The the part that is between the 1st and 2nd spaces, not including either one, is placed in WS-MIDDLE, and so on. USAGE can be used in conjunction with the PIC clause to specify how numeric data is to be stored The most common options are DISPLAY the default , COMP and COMP-3 COMP is short for COMPUTATIONAL, which can also be used The words USAGE IS are optional USAGE is only valid with numeric fields It can be specified as follows. A number stored as COMP is in binary format A COMP-3 number is stored as packed-decimal. The USING clause is used to pass parameters from one program to another It appears in the Call statement of the calling program to specify the parameter list These parameters must be working storage fields. The called program must have a USING clause on its PROCEDURE DIVISION sta tement followed by the parameters the program is receiving These fields are defined in the LINKAGE SECTION of the DATA DIVISION, which follows the WORKING-STORAGE SECTION All of the received fields are updateable by the called program. The parameters do not have to have the same names in the calling and called programs but the sizes and data types have to match. See the algorithms page for sample code on calling one program from another. Value allows you to initialize a field at the same time it is defined The VALUE clause follows the PIC clause and must be the proper type of data The value can be changed in code at any time. Some compilers will require the VALUE data to be the proper size also, others will truncate to fit Most compilers will not allow VALUEs in input FDs - it is a bad idea in any case. The write statement will write data to the specified file The file must be opened for output Attempting to write to an unopened file or a file opened for input will produce a run-time error. Optional clauses are FROM, BEFORE and AFTER FROM specifies a working-storage field from which the system will select the data that is to be written FROM can appear with either BEFORE or AFTER. BEFORE and AFTER specify actions to be taken by the printer along with writing a record of data You can either specify the number of lines that are to be advanced or you can specify advancing to the top of the next page BEFORE and AFTER cannot appear in the same write. This document will focus on a discussion of a numeric field or data string known as PACKED-DECIMAL format also referred to as packed data or a packed numeric field This format is used on an IBM Mainframe System and is supported by Micro Focus COBOL running on a Linux, UNIX or Windows System. Note The items in this document are appropriate for applications that are written in COBOL, Mainframe Assembler HLASM or PL I The IBM Mainframe architecture drove many of the numeric formats that existed in the early ANSI specifications for COBOL and have been carried forward to the current COBOL ANSI specifications. A packed decimal representation stores two decimal digits in one byte A packed decimal representation stores decimal digits in each nibble of a byte a byte is eight bits and a nibble is four bits Each byte has two nibbles, and each nibble is indicated by a hexadecimal digit For example, the value 23 would be stored in two nibbles, using the hexadecimal digits 2 and 3 the bit representation would be 0010 0011 The sign indication is dependent on your operating environment On an IBM mainframe, the sign is indicated by the last nibble of the last byte or high memory address For explicitly signed fields the C indicates a positive value and D indicates a negative value For unsigned or implied positive fields the F indicates a positive value. The mainframe can perform arithmetic functions on packed-decimal fields without having to convert the format Storing numeric values in a packed-decimal format may save a significant am ount of storage space For example, on the mainframe the value 12,345 would be five 5 bytes in length i e x F1F2F3F4F5 If the same information is stored in a packed-decimal i e USAGE IS COMPUTATIONAL-3 or abbreviated as COMP-3 the field would be three 3 bytes in length i e x 12345C. When converting records or data structures that contain this type of field from EBCDIC to ASCII the programmer is presented with a number of confusing options and challenges This document will try to explain the options and help the programmer avoid the common mistakes that are made during a conversion process. The following table shows the structure of a five digit numeric field using the Packed-Decimal format i e the COBOL syntax would be USAGE IS COMP-3 The field contains a value of one-hundred-twenty-three or 00123 Since the packed-decimal format stores a digit in each nibble 2 digits per byte the actual field size is only three 3 bytes. The Packed Decimal Format for a Numeric Field. Note-1 A field that is d efined as Unsigned i e PIC 99999 COMP-3 is an implied positive value Note-2 The Hex is an abbreviation for Hexadecimal notation Note-3 A field that is defined as Signed i e PIC S99999 COMP-3 will have the sign in the rightmost nibble of the units positions or Byte-2 in the preceding example A X nC is used as an explicit positive sign and a X nD is used as an explicit negative sign Note-4 The Packed-decimal format is the same for the Mainframe and for Micro Focus running on a Windows or UNIX system. We have made a significant effort to ensure the documents and software technologies are correct and accurate We reserve the right to make changes without notice at any time The function delivered in this version is based upon the enhancement requests from a specific group of users The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources. Copyright 1987-2017 SimoTime Technologies All Rights Reserved. Table, Packed-Decimal Field S izes. The following is a table that shows the actual field sizes for a COMP-3 or packed-decimal based on the number of digits specified in the picture clause. Convert Packed-Decimal to Text. This section describes how to convert the previously discussed packed-decimal formats into text strings to print or display the information in a human readable form Before converting the packed-decimal fields it should be determined if a conversion is necessary The following list provides some basic guidelines. When migrating an application both data and COBOL programs for processing the data from an IBM Mainframe System to a Windows System with Micro Focus Enterprise Server a conversion of the Packed-Decimal fields is not necessary Micro Focus COBOL supports the packed-decimal format. When migrating an application both data and COBOL programs for processing the data from an IBM Mainframe System to a Linux or UNIX System with Micro Focus Enterprise Server a conversion of the Packed-Decimal fields is not necessary Micro Focus COBOL supports the packed-decimal format. When migrating or transferring data from a COBOL oriented, IBM Mainframe or AS 400 environment to a non-COBOL oriented Linux, UNIX or Windows environment i e ASCII Text or excel spreadsheet then a conversion will be required This may require two conversion tasks The packed-decimal fields or data strings will need to be converted to a zoned-decimal format sign leading separate with an explicit decimal point should be considered depending on the target environment The zoned-decimal format may then require a conversion from EBCDIC to ASCII. When using the File Transfer Protocol FTP to transfer a data file between a Mainframe System and a Linux, UNIX or Windows System it will be necessary to use the BINARY mode if the records contain packed-decimal fields If a conversion between EBCDIC and ASCII is required it will need to be done after the file transfer. Convert to Text with Explicit Sign. This section describes how to convert a packed-decimal field i e PIC S9 5 USAGE IS COMPUTATIONAL-3 to a zoned-decimal field i e PIC S9 5 USAGE IS DISPLAY SIGN LEADING SEPARATE The resulting field will have a separate leading sign but will still have an implied decimal based on the field definition from the COBOL picture clause. Convert to Text with Explicit Decimal. This section describes how to convert a packed-decimal field i e PIC S9 5 USAGE IS COMPUTATIONAL-3 to a zoned-decimal field i e PIC X The resulting field will have a separate leading sign and an explicit decimal point embedded in the text string This field or data string may easily be exported to a non-COBOL environment. Spaces in a Packed Field. We have seen a few instances where a packed field may contain SPACES This should be considered a bad programming practice Having non-numeric values in a numeric field should be avoided The process that caused non-numeric values to be placed in a numeric field should be corrected When converting data between EBCDIC and ASCII this presents an additional effort to deal with the situation. A SPACE character hex 40 for EBCDIC or a hex 20 for ASCII could be a valid numeric entry in a packed field in all the positions of the field except the units positions It would be reasonable to assume that if the units position of a packed field is a SPACE character and all other positions are SPACE characters then the packed field SPACE values should be converted between EBCDIC and ASCII. For numeric fields with USAGE IS COMP-3 i e PACKED FIELDS the conversion code generated by SimoTime does not do any conversion This is the default behavior However, since the situation does exist the SimoTime technology has a configuration option to generate conversion code that will analyze a packed field and convert SPACE values between EBCDIC and ASCII or to initialize the packed field with a ZERO value. The following is sample code that will test a packed field for SPACE values and then convert the EBCDIC SPACE values to ASCII SPACE val ues. The following is sample code that will test a packed field for SPACE values and then initialize the packed field to ZERO values. When trying to do an arithmetic operation on a packed field that has a non-numeric value or an invalid sign the operation will ABEND with a S0C7 Program check on the Mainframe System The operation will ABEND with a 163 RTS error on a Micro Focus System. This condition is managed on the EBCDIC-encoded Mainframe System by using the NUMPROC NOPFD compiler option that accepts the invalid sign and treats space characters x 40 as zeroes This approach does not fix the problem, it simply tolerates the condition while presenting additional challenges for the data conversion and validation efforts. For files that contain records with packed or binary fields the EBCDIC to ASCII data conversion is done at the field level Since the packed and binary fields have their unique bit structure i e neither EBCDIC nor ASCII they are left in their existing structure Therefore, a packed field that contains all x 40 characters will contains all x 40 characters after the record is converted. Herein lies the challenge, the x 40 character is a space character on the EBCDIC-encoded Mainframe System but it is not a space character in an ASCII-configured environment. In an ASCII-configured Micro Focus environment the spaces in a numeric, packed field can be managed by using the SIGN-FIXUP compiler directive This directive provides limited emulation of NUMPROC NOPFD when used with HOSTNUMMOVE HOSTNUMCOMPARE. However, since the x 40 value is not a space character in the ASCII environment and is a valid numeric value in a packed field it will produce incorrect totals when used in an arithmetic operation Therefore, at a minimum the x 40 values will need to be changed to an ASCII space or x 20 character. Note the process that causes the packed fields to contain SPACE characters should be addressed The Compiler options only prevent the ABEND but may produce incorrect results wh en used in arithmetic processing. The following link will provide more details about compiler directives and numeric field processing. Explore the Compiler Directives available for the Micro Focus COBOL technologies. Explore how to process non-Numeric Values stored in a Packed-Decimal format This document will use examples to show how to manage a situation where non-numeric values such as Space Characters are placed in a Packed-Decimal field and then managed to avoid a S0C7 or RTS 163 error message and an abnormal termination of the program. The purpose of this document is to provide an overview of numeric data strings or fields that are packed-decimal format This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers. In the world of programming there are many ways to solve a problem This document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives. The documentation and software were developed and tested on systems that are configured for a SimoTime environment based on the hardware, operating systems, user requirements and security requirements Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration. SimoTime Services has experience in moving or sharing data or application processing across a variety of systems For additional information about SimoTime Services or Technologies please send an e-mail to or call 415 883-6565 We appreciate hearing from you. Software Agreement and Disclaimer. Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the Simo Time copyright notice appear on all copies of the software The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies. SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose It is provided AS IS without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material. Downloads Links. This section includes links to documents with additional information that are beyond the scope and purpose of this document The fir st sub-section requires an internet connection, the second sub-section references locally available documents. Note A SimoTime License is required for the items to be made available on a local server. Current Server or Internet Access. The following links may be to the current server or to the Internet. Note The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the icon If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the icon. Explore how to process non-Numeric Values stored in a Packed-Decimal format This document will use examples to show how to manage a situation where non-numeric values such as Space Characters are placed in a Packed-Decimal field and then managed to avoid a S0C7 or RTS 163 error message and an abnormal termination of the program. Explore how to Calculate a Record Count and Accumulate Summary Totals by reading a Record Sequ ential Data File Each record contains numeric fields with a packed-decimal COMP-3 format The count and totals will be posted to the SYSOUT device. Explore The Binary or COMP format for numeric data strings This numeric structure is supported by COBOL and may be explicitly defined with the USAGE IS COMP or USAGE IS BINARY clause. Explore The Edited for Display format for numeric data strings This numeric structure is supported by COBOL and may be used with an edit-mask to prepare the presentation for readability by human beings. Explore The Packed-Decimal or COMP-3 format for numeric data strings This numeric structure is supported by COBOL and may be explicitly defined with the USAGE IS COMP-3 clause. Explore The Zoned-Decimal format for numeric data strings This numeric structure is the default numeric for COBOL and may be explicitly defined with the USAGE IS DISPLAY clause. Explore commonly used formats and processing techniques for managing various numeric formats available on the mainfr ame. Explore the Numbers Connection for additional information about the structure and processing of numeric data items or numeric fields. Explore the Compiler Directives available for the Micro Focus COBOL technologies. Explore How to Generate a Data File Convert Program using simple specification statements in a Process Control File PCF This link to the User Guide includes the information necessary to create a Process Control File and generate the COBOL programs that will do the actual data file conversion The User Guide contains a list of the PCF statements that are used for the data file convert process. Explore How to Generate a Data File Compare, Validate or Hex-Dump Program using simple specification statements in a Process Control File PCF This link to the User Guide includes the information necessary to create a Process Control File and generate the COBOL programs that will do a data file compare, accumulate summary totals with a record count or produce a Hex-Dump of records in a VSAM, KSDS based on a list of user-defined keys The User Guide contains a list of the PCF statements that are used for the data file compare, validate or dump process. Explore a typical data file conversion process that may be required when working in a multi-system environment This suite of documents describes a model for managing non-relational data structures Sequential Files and VSAM Data Sets that contain ASCII or EBCDIC text strings and various numeric formats such as BINARY, PACKED-Decimal and ZONED-Decimal This model has the capability of creating a test file for an ASCII or EBCDIC encoded environment This suite of documents will address many of the challenges of doing a record content conversion of a file that will be transferred between an EBCDIC-encoded Mainframe System and an ASCII-encoded Linux, UNIX or Windows System. Explore The ASCII and EBCDIC Translation Tables These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats. Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and or QSAM files. Internet Access Required. The following links will require an internet connect. A good place to start is The SimoTime Home Page for access to white papers, program examples and product information This link requires an Internet Connection. Explore The Micro Focus Web Site for more information about products and services available from Micro Focus This link requires an Internet Connection. Glossary of Terms. Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papersments or Feedback. This document was created and is copyrighted and maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please call or send an e-mail to. We appreciate hearing from youpany Overview. SimoTime Technologies was founded in 1987 and is a privately owned company We specialize in the creation and deployment of business applications using new or existing technologies and services We have a team of individuals that understand the broad range of technologies being used in today s environments Our customers include small businesses using Internet technologies to corporations using very large mainframe systems. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms. Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process SimoTime has the technology, servi ces and experience to assist in the application and data management tasks involved with doing business in a multi-system environment. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at. Packed-Decimal Format, Description and Discussion. Note 1 A binary field that is defined as Unsigned i e PIC 999 is an implied positive value A two 2 byte unsigned, binary field may contain a range of implied positive values from 0 to 65,535.Note 2 A binary field that is defined as Signed i e PIC S999 will use the high-order, leftmost bit as the sign A zero 0 is a positive sign and a one 1 is a negative sign A two 2 byte signed, binary field may contain a range of values from -32,767 to 32,767.The BINARY Format for a Numeric Field. We have made a significant effort to ensure the documents and software technologies are correct and accurate We reserve the right to make changes without n otice at any time The function delivered in this version is based upon the enhancement requests from a specific group of users The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources. Copyright 1987-2017 SimoTime Technologies All Rights Reserved. The Idiosyncrasies of COMP Fields. The creation and processing of COMP or BINARY data on a Windows or UNIX platform must be done in the same manner as the mainframe On the mainframe COMP or BINARY fields must be 2, 4, or 8 bytes in length the mainframe was originally a half-word, full-word and double-word centric system On Linux, UNIX or Windows using Micro Focus COBOL with Net Express or Server Express the COMP or BINARY fields may be 1 through 8 bytes in length. Note The syntax for COBOL is USAGE IS COMPUTATIONAL However, this is usually abbreviated to COMP or may be coded as BINARY. Notice the following, the record layout for the Item Master File contains two 2 COMP or BINARY fi elds These fields are defined as PIC 9 7 and may contain values from zero 0 through 9,999,999 or the binary values of x 000000 through x 98967F which may be contained in a three 3 byte binary field. Herein is the problem, on the EBCDIC-encoded, half-word, full-word, double-word, mainframe environment the fields would be allocated with an actual length of four 4 bytes for a binary field For the Micro Focus, ASCII-encoded, byte-oriented environment the fields would be allocated with an actual length of three 3 bytes for a binary field. The solution to this problem for the Micro Focus environment is to use the IBMCOMP and NOTRUNC directives when compiling the programs This will enforce the mainframe rules for COMP or BINARY fields and the field lengths will be the same as the mainframe. An alternative solution is to modify the copy file and change the PIC 9 7 to PIC 9 9 However, this solution requires a source code change and is not recommended during the first phase of a data migration. Nume ric Field Definitions Lengths. The following table shows the COBOL picture clause, the number of digits, the length of a packed field, the length of a binary COMP field for an IBM Mainframe and the length of a binary field for the Linux, UNIX and Windows LUW environments running Micro Focus COBOL. The differences in field or data string length are high-lighted in RED. It is important to note that Micro Focus Mainframe Express supports the mainframe format for binary or COMP fields This is accomplished by pre-setting the compiler directives to force this behavior The compiler directives are IBMCOMP and NOTRUNC These directives may also be used with Net Express and must be configured manually since the default for Net Express is to allow binary fields to be any length. Big Endian Little Endian. Information is usually process by executing programs that were created using a program language that separates the user programmer from the underlying hardware structure However, this separation is not one-hundred percent Therefore, some level of awareness or understanding of the hardware may be required The hardware techniques used to define, process, save and retrieve numeric values is typically an area where some level of understanding is required. First, lets review how units of information are structured in a typical computer system. A bit is a unit of information A bit may be in an OFF or ON condition that is traditionally referred to as 0 or 1 Four 4 bits make a nybble and eight bits or 2 nybbles make a byte. Note The term nibble is commonly used but the original spelling was nybble. Next, lets review how units of information are stored in memory and processed by the system. In order to understand the concept of Big and Little Endian we need to understand memory typically referred to as RAM or Random Access Memory We may think of RAM as one large array with many one-byte elements An Index is typically used to access a specific element within an array An Address is typically used t o access a specific location within RAM or memory. Note For this discussion we are using a RAM architecture that stores one byte in each RAM location There are some RAM architectures where each memory location stores something besides a byte However, these are rare so we will limit this discussion to RAM architectures that are byte oriented. An IBM Mainframe System has the hardware capability of performing arithmetic tasks using a variety of different formats Since we are currently focused on a discussion of Big and Little Endian formats we will limit this discussion to 32 bit or 4 byte integers For COBOL programmers this would be USAGE IS COMPUTATIONAL. The question, How are these 4 bytes placed in RAM for processing. The answer, It depends, The IBM Mainframe System uses Big Endian and the hardware that is used to run Linux, UNIX and Windows typically use Little Endian It would be important to note that Micro Focus COBOL has a compiler directives IBMCOMP that provides support for the Big Endian support for COMP fields. The following shows how the 4 bytes of a 32 bit integer are arranged in RAM starting at an address location of 100.Note Notice the bytes of the little endian are in the reverse order when compared to big endian format With little endian the least significant byte is stored first With big endian the most significant byte is stored first. Next, lets review how data files are used to save and retrieve units of information. To understand the importance of endianness lets take a look at the following example. A data string of x 1A2B3C4D is written to a file on a system that uses big endian. This is hexadecimal notation of four bytes 1A, 2B, 3C and 4D or 32 bits 0001 1010 0010 1011 0011 1100 0100 1101.On a Little Endian System this would represent a decimal numeric value of 1,295,788,826.Attention This would result in a difference of 856,747,725 between the expected value and the actual value. The purpose of this document is to provide an overview of binary formats for numeric data strings or fields This document may be used as a tutorial for new programmers or as a quick reference for experienced programmers. In the world of programming there are many ways to solve a problem This document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives. The documentation and software were developed and tested on systems that are configured for a SimoTime environment based on the hardware, operating systems, user requirements and security requirements Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration. SimoTime Services has experience in moving or sharing data or application processing across a variety of systems For additional information about SimoTime Services or Technologies please send an e-mail to or call 415 883-6565 We appreciate hearing from you. Software Agreement and Disclai mer. Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies. SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose It is provided AS IS without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement SimoTime Technologies shall not be liable for any direct, indirect, special or con sequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material. Downloads Links. This section includes links to documents with additional information that are beyond the scope and purpose of this document The first sub-section requires an internet connection, the second sub-section references locally available documents. Note A SimoTime License is required for the items to be made available on a local server. Current Server or Internet Access. The following links may be to the current server or to the Internet. Note The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the icon If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the icon. Explore The Binary or COMP format for numeric data st rings This numeric structure is supported by COBOL and may be explicitly defined with the USAGE IS COMP or USAGE IS BINARY clause. Explore The Edited for Display format for numeric data strings This numeric structure is supported by COBOL and may be used with an edit-mask to prepare the presentation for readability by human beings. Explore The Packed-Decimal or COMP-3 format for numeric data strings This numeric structure is supported by COBOL and may be explicitly defined with the USAGE IS COMP-3 clause. Explore The Zoned-Decimal format for numeric data strings This numeric structure is the default numeric for COBOL and may be explicitly defined with the USAGE IS DISPLAY clause. Explore commonly used formats and processing techniques for managing various numeric formats available on the mainframe. Explore the Numbers Connection for additional information about the structure and processing of numeric data items or numeric fields. Explore How to Generate a Data File Convert Program using simp le specification statements in a Process Control File PCF This link to the User Guide includes the information necessary to create a Process Control File and generate the COBOL programs that will do the actual data file conversion The User Guide contains a list of the PCF statements that are used for the data file convert process. Explore a typical data file conversion process that may be required when working in a multi-system environment This suite of documents describes a model for managing non-relational data structures Sequential Files and VSAM Data Sets that contain ASCII or EBCDIC text strings and various numeric formats such as BINARY, PACKED-Decimal and ZONED-Decimal This model has the capability of creating a test file for an ASCII or EBCDIC encoded environment This suite of documents will address many of the challenges of doing a record content conversion of a file that will be transferred between an EBCDIC-encoded Mainframe System and an ASCII-encoded Linux, UNIX or Windows System. Explore The ASCII and EBCDIC Translation Tables These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats. Explore The File Status Return Codes to interpret the results of accessing VSAM data sets and or QSAM files. Internet Access Required. The following links will require an internet connect. A good place to start is The SimoTime Home Page for access to white papers, program examples and product information This link requires an Internet Connection. Explore The Micro Focus Web Site for more information about products and services available from Micro Focus This link requires an Internet Connection. Glossary of Terms. Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papersments or Feedback. This document was created and is copyrighted and maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please call or send a n e-mail to. We appreciate hearing from youpany Overview. SimoTime Technologies was founded in 1987 and is a privately owned company We specialize in the creation and deployment of business applications using new or existing technologies and services We have a team of individuals that understand the broad range of technologies being used in today s environments Our customers include small businesses using Internet technologies to corporations using very large mainframe systems. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms. Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform The da ta will need to be transferred between the systems and may need to be converted and validated at various stages within the process SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at. Binary or COMP Format, a Description and Discussion.

No comments:

Post a Comment